Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Create Word Document Error

Status
Not open for further replies.

mevasquez

Programmer
Aug 26, 2003
75
US
I just upgraded to Office 2003 on the client machine and when I try to submit a form that opens a work document, I get an error, "Error: ActiveX component can't create object: 'Word.Application'. Has something changed in Office 2003? My code that used to work is as follows:

Code:
Dim oWA
Dim oWD
Dim oTables
Dim oTable
Dim strServerName
set oWA = CreateObject("Word.Application") [COLOR=green]'Here is where I get the error[/color]
strServerName="<%=Request.ServerVariables("SERVER_NAME")%>"

If strServerName = "localhost" Then
    Set oWD = oWA.Documents.Open("[URL unfurl="true"]http://localhost/Templates/TrainingSheet.doc")[/URL]
Else
    Set oWD = oWA.Documents.Open("[URL unfurl="true"]https://"[/URL] & strServerName & "/Templates/TrainingSheet.doc")
End If

Set oTables = oWD.Tables
Set oTable = oTables.Item(1)
<%=strWordCommands %>
oWA.Visible = True
oWD.UserControl = True
Set oTables = Nothing
Set oTable = Nothing
Set oWD = Nothing
Set oWA = Nothing

TIA

Mike
 
I believe so. The beginning of the script begins with
Code:
<%@ Language = "VBScript" %>
<% option explicit %>
<% Response.Buffer = true %>
Shouldn't it open a document on my computer when accessing this Web page. My computer has Office 2003. The server does not.

Mike
 
It sounds like maybe this file has some VBScript that runs on the server (ASP) and some other VBScript that runs on the browser (non-ASP).

It looks like the word application is being created by the non-ASP code because it uses plain CreateObject rather than Server.CreateObject
 
What would be my solution to create the word application?

Mike
 
Found the problem. Internet Explorer security was set wrong. When I set "Initialized and script ActiveX controls not marked as save" to "Prompt", it worked. Mine was set to disable.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top