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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP!!!

Status
Not open for further replies.

McGoat

MIS
Joined
Jun 7, 2001
Messages
11
Location
DK
I have this script in my HTML page:

<script language=&quot;VBScript&quot;>

Sub LoadTemplate(strPath)
Dim objWord

On Error Resume Next
Set objWord = GetObject(, &quot;Word.Application&quot;)
If Err.number <> 0 Then
Set objWord = CreateObject(&quot;Word.Application&quot;)
End If
Err.Clear
On Error Goto 0

objWord.Visible = True
objWord.Documents.Add strPath
End Sub

</script>

and then a link:

<a href=&quot;#&quot; onClick=&quot;LoadTemplate ('test.dot')&quot;>TEST</a>

But Internet Explorer gives me this error:

Error: Object required: ‘objWord’
Code: 0


Anyone??
 
For me its working properly,

pls check ur MS word Installation and version or
check it after re-Installing MS-Word.

another possibility is that ur registry might have been curropted
 
I don't have a soluton for MCGoat, but rather a question concerning the same topic. I need to pass the document name to the same script using a variable, but when I do, I get a 'type mismatch' error.
Here is my code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Dim myDoc %>
<% myDoc = trim(request.QueryString("docName"))%>
<SCRIPT LANGUAGE=VBScript>")
Dim objWord
Sub Btn1_onclick()
Set objWord = CreateObject("Word.Application")
objWord.Visible = true
objWord.Documents.Open &myDoc)
objWord.PrintOut
objWord.Quit
End Sub
</SCRIPT>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p><A href="#" onClick="Btn1_onclick()">Print</A></p>






Any ideas? ALL help is MOST appreciated.

thanks
JSearcy
 
Replace this:
objWord.Documents.Open &myDoc)
By this:
objWord.Documents.Open myDoc

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV - thanks for the quick reply and the suggestion.
I changed the code as you demonstrated, but I still get this error:
Type mismatch: 'objWordDocuments.Open'

There has to be something simple that I am overlooking...

thanks
JSearcy
 
BTW, myDoc is a server-side variable !
What about something like this ?
objWord.Documents.Open <%=myDoc%>

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top