D
DESPERATE IN MS
Can some please tell me what I'm missing or what I have wrong.
Here is my code for embedding documents:
Public Sub WOHdrFtr()
'
' Work Oder Header Macro
' Macro recorded 3/17/2009 XXXXXXXXXXXXXXXXXXXXX(data is good)
'
Dim wrdDoc As Word.Document
Selection.InsertFile FileName:="O:\Routine Maintenance\Routine Planner
Share\Common\Macros\Docs\WoHdrFtr.doc", Range:="", ConfirmConversions _
:=False, Link:=False, Attachment:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
End Sub
The VB code is in a custom template I have created with a custom toolbar
assigned to each new document which is ran by the VB code.
The word template "embeds" these documents and saves as a ole to a server.
This all is working fine except I get an error "91" Objext variable or With
Block variable not set on " Selection.InsertFile FileName:="O:\Routine
Maintenance\Routine Planner
Share\Common\Macros\Docs\Clay\EnergyWeldAApecStic.doc", Range:="",
ConfirmConversions _:=False, Link:=False, Attachment:=False
Here is my code for embedding documents:
Public Sub WOHdrFtr()
'
' Work Oder Header Macro
' Macro recorded 3/17/2009 XXXXXXXXXXXXXXXXXXXXX(data is good)
'
Dim wrdDoc As Word.Document
Selection.InsertFile FileName:="O:\Routine Maintenance\Routine Planner
Share\Common\Macros\Docs\WoHdrFtr.doc", Range:="", ConfirmConversions _
:=False, Link:=False, Attachment:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
End Sub
The VB code is in a custom template I have created with a custom toolbar
assigned to each new document which is ran by the VB code.
The word template "embeds" these documents and saves as a ole to a server.
This all is working fine except I get an error "91" Objext variable or With
Block variable not set on " Selection.InsertFile FileName:="O:\Routine
Maintenance\Routine Planner
Share\Common\Macros\Docs\Clay\EnergyWeldAApecStic.doc", Range:="",
ConfirmConversions _:=False, Link:=False, Attachment:=False