S
Sergio Florez M.
I recorded a Macro in Word doc in order to place the code
in an Access form. This code writes some text in the doc
header and it works fine in word but in access it says
something about an invalid object when opening the header.
Dim Objword As Word.Application
Set Objword = New Word.Application
Objword.Visible = True
Objword.Documents.Open
FileName:="C:\PlantillaInicialCorrespondencia.doc", _
ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
Revert:=False, _
WritePasswordDocument:="",
WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
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
--> ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader <-- this is where the error is
lifted
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeText Text:="Id: xxxxx"
ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
Selection.TypeParagraph
in an Access form. This code writes some text in the doc
header and it works fine in word but in access it says
something about an invalid object when opening the header.
Dim Objword As Word.Application
Set Objword = New Word.Application
Objword.Visible = True
Objword.Documents.Open
FileName:="C:\PlantillaInicialCorrespondencia.doc", _
ConfirmConversions:=False, ReadOnly:=False,
AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="",
Revert:=False, _
WritePasswordDocument:="",
WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto
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
--> ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader <-- this is where the error is
lifted
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeText Text:="Id: xxxxx"
ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
Selection.TypeParagraph