Sub AutoOpen()
'
' AutoOpen Macro
ActiveWindow.DocumentMap = True
'The following code snippet does NOT work, any help would be appreciated
Selection.Style = ActiveDocument.Styles("Heading 1")
End Sub
Printable View
Sub AutoOpen()
'
' AutoOpen Macro
ActiveWindow.DocumentMap = True
'The following code snippet does NOT work, any help would be appreciated
Selection.Style = ActiveDocument.Styles("Heading 1")
End Sub
If you want to select the first instance of the style in a document, if present, then
Code:Sub AutoOpen()Dim orng As Range
Set orng = ActiveDocument.Range
With orng.Find
.Style = "Heading 1"
Do While .Execute
orng.Collapse 1
orng.Select
Exit Do
Loop
End With
Set orng = Nothing
End Sub
Hopefully, this will clarify my question:
I want upon opening a document with various Styles in a doc to show in the Navigation Pane, the various Styles 1,2,3, and so on Collapsed
I have Googled and Bing for a solution previous to my question; but, alas, I cannot find a solution
Thank you