I have written a print facility which first writes to a word document, closes this document and then opens it in a read only mode (to preview). In this way the user will be have all the options provided by word.
The problem happens when:
I first run the print process and when finished I will physically close the word document. On running the print process the second time I will get the error message:
run-time error 462
The remote server machine does not exist or is unavailable
The following is the code to write the document
'Activate The word application
Set WordApplication = CreateObject("Word.Application"
WordApplication.Visible = False
WordApplication.WindowState = wdWindowStateMinimize
'Creates a new document, saves it and then closes it
Documents.Add
ActiveDocument.SaveAs FileName:=Trim(strCreateFile)
WordApplication.Visible = False
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=6, NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
.
.
.
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Close
DisplayBox = Documents.Open(strFileName, , ReadOnly)
WordApplication.Visible = True
WordApplication.WindowState = wdWindowStateMaximize
Can one please help.
Thanks in advance
The problem happens when:
I first run the print process and when finished I will physically close the word document. On running the print process the second time I will get the error message:
run-time error 462
The remote server machine does not exist or is unavailable
The following is the code to write the document
'Activate The word application
Set WordApplication = CreateObject("Word.Application"
WordApplication.Visible = False
WordApplication.WindowState = wdWindowStateMinimize
'Creates a new document, saves it and then closes it
Documents.Add
ActiveDocument.SaveAs FileName:=Trim(strCreateFile)
WordApplication.Visible = False
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=6, NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed)
.
.
.
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Close
DisplayBox = Documents.Open(strFileName, , ReadOnly)
WordApplication.Visible = True
WordApplication.WindowState = wdWindowStateMaximize
Can one please help.
Thanks in advance