A
Andy Smith
I am looking for a workaround to the following issue
http://support.microsoft.com/?id=275966
I have 70+ templates so would rather change the code
This is what we have
***********************************
'Get the document to be opened
goWord.Documents.Open Filename
If goWord.ActiveDocument.ProtectionType <>
wdNoProtection Then
goWord.ActiveDocument.Unprotect "Protected"
End If
'turn error handling off while we see if we can access
the page setup object in a particular way.
On Error Resume Next
'see if we can get at the page setup object this way
iTest = goWord.ActiveDocument.Sections
(1).Range.Paragraphs(1).Range.PageSetup
If Err.Number = 0 Then
With goWord.ActiveDocument.Sections
(1).Range.Paragraphs(1).Range.PageSetup
.FirstPageTray = FirstPageTray
.OtherPagesTray = SubsPagesTray
End With
Else
Err.Clear
With goWord.ActiveDocument.PageSetup
.FirstPageTray = FirstPageTray
.OtherPagesTray = SubsPagesTray
End With
End If
****************************
If the first object on the template is a frame then
the "Page Setup" option is disabled and trying to get at
the object will cause the error as the frame is selected
in word.
How can I move the selection in code to a position that
will exist on all templates so that the "Page Setup"
object will become available.
If there is no frame there when the document is
unprotected I do not have an issue.
Many thanks
Andy
http://support.microsoft.com/?id=275966
I have 70+ templates so would rather change the code
This is what we have
***********************************
'Get the document to be opened
goWord.Documents.Open Filename
If goWord.ActiveDocument.ProtectionType <>
wdNoProtection Then
goWord.ActiveDocument.Unprotect "Protected"
End If
'turn error handling off while we see if we can access
the page setup object in a particular way.
On Error Resume Next
'see if we can get at the page setup object this way
iTest = goWord.ActiveDocument.Sections
(1).Range.Paragraphs(1).Range.PageSetup
If Err.Number = 0 Then
With goWord.ActiveDocument.Sections
(1).Range.Paragraphs(1).Range.PageSetup
.FirstPageTray = FirstPageTray
.OtherPagesTray = SubsPagesTray
End With
Else
Err.Clear
With goWord.ActiveDocument.PageSetup
.FirstPageTray = FirstPageTray
.OtherPagesTray = SubsPagesTray
End With
End If
****************************
If the first object on the template is a frame then
the "Page Setup" option is disabled and trying to get at
the object will cause the error as the frame is selected
in word.
How can I move the selection in code to a position that
will exist on all templates so that the "Page Setup"
object will become available.
If there is no frame there when the document is
unprotected I do not have an issue.
Many thanks
Andy