M
Me
The following VB Code does not work correctly. It bombs out at the
"ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader" line.
I don't have any experience in coding. Would anyone know why this is failing?
Thanks in advance
--------------------------
Sub AutoNew()
Selection.HomeKey Unit:=wdStory
Selection.WholeStory
Selection.Fields.Update
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.NextHeaderFooter
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.HomeKey Unit:=wdStory
End Sub
------------------------------
"ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader" line.
I don't have any experience in coding. Would anyone know why this is failing?
Thanks in advance
--------------------------
Sub AutoNew()
Selection.HomeKey Unit:=wdStory
Selection.WholeStory
Selection.Fields.Update
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or
ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.NextHeaderFooter
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.HomeKey Unit:=wdStory
End Sub
------------------------------