OK here is the text of my vbs file, which I am calling using wscript.exe (Windows Scripting):
Dim objApp 'variable for an instance of the appropriate Application'
Dim objDoc 'variable for an instance of document'
Dim result 'variable for result to html.xla'
Dim newFileName 'variable for new file name'
On Error Resume Next
dname = WScript.Arguments(0)
newFileName=left(dname,len(dname)-4) + ".htm"
Select Case right(dname,3)
Case "doc"
'create an instance of Word'
Set objApp = CreateObject("Word.Application"
'open the document'
objApp.Documents.Open "E:\inetpub\& dname
if err<>0 then
strErrorMessage = "Error: " & Err.Number
MsgBox strErrorMessage, CRITICAL_ERROR + MSGBOX_OKONLY, "Error Type
= " & Err.Description
objApp.quit
exit sub
end if
blah,blah, blah
I have enabled error handling, I think, by including the On Error
Resume Next. However, I get a Windows Script Host error message as
soon as the Documents.Open fails; it never gets to the "if err<> 0"
line. This has resulted in about 25 instances of Word being open on
my Web development server!
What am I doing wrong?
Kathryn
Dim objApp 'variable for an instance of the appropriate Application'
Dim objDoc 'variable for an instance of document'
Dim result 'variable for result to html.xla'
Dim newFileName 'variable for new file name'
On Error Resume Next
dname = WScript.Arguments(0)
newFileName=left(dname,len(dname)-4) + ".htm"
Select Case right(dname,3)
Case "doc"
'create an instance of Word'
Set objApp = CreateObject("Word.Application"
'open the document'
objApp.Documents.Open "E:\inetpub\& dname
if err<>0 then
strErrorMessage = "Error: " & Err.Number
MsgBox strErrorMessage, CRITICAL_ERROR + MSGBOX_OKONLY, "Error Type
= " & Err.Description
objApp.quit
exit sub
end if
blah,blah, blah
I have enabled error handling, I think, by including the On Error
Resume Next. However, I get a Windows Script Host error message as
soon as the Documents.Open fails; it never gets to the "if err<> 0"
line. This has resulted in about 25 instances of Word being open on
my Web development server!
What am I doing wrong?
Kathryn