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!

Error while trying to create a Word Document (Client Side) in ASP

Status
Not open for further replies.

Aido

Programmer
Mar 21, 2001
5
0
0
IE
I have a Server that has not got Word installed on it and I am trying to run the following script on a clients machine :

<script language=&quot;VBScript&quot;>
Dim objWord
Set objWord=CreateObject(&quot;Word.Application&quot;)
.....

The client machine has office installed on it. I get the following error when I run the above script :

Error Type:
Microsoft VBScript runtime (0x800A01AD)
ActiveX component can't create object: 'Word.Document'

Please help as I can't seem to figure out why this won't work. The microsoft site said that this is the correct syntax for doing this so I am really stumped.
 
Might Help,
try this:
Sub MakeWord()
Dim myWdApp,myWd
Set myWdApp = CreateObject(&quot;Word.Application&quot;)
myWdApp.Visible = True
Set myWd = myWdApp.Documents.Add
End Sub
Note: This creates the instance on the client machine and not on your server.
To create an instance on your server you need to have a registered dll(COM) on the server and use:
Set myWdApp = Server.CreateObject(&quot;Word.Application&quot;)
 
I tried this and got the same thing. Thanks for your help anyway.
 
Does the pc you're working on have the MS Office Object lib?
 
Also, you have to lower the security settings on the browser to allow the creation of the instance.

Dim myWdApp, myWd

On Error Resume Next

Set myWdApp = CreateObject(&quot;Word.application&quot;)
myWdApp.Visible = True
Set myWd = myWdApp.Documents.Add

If Err.Number<>0 Then
If Err.Number=424 Then
Msgbox &quot;Your security settings are too high to run this function.&quot; & vbcrlf & &quot;Please change these settings and try again - instructions will be given on this page.&quot;,vbinformation
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top