Dave T
03-22-2010, 05:28 PM
Hello All,
I posted this message in another forum, but the responses are received via individual e-mails, so I thought I’d try a different forum where all replies are in the same place so my apologies if some consider this cross posting.
When I use Excel 2003 I have a macro I use for quick navigation between worksheets within a workbook.
Sub SheetList()
On Error Resume Next
Application.CommandBars("Workbook Tabs").Controls("More Sheets...").Execute
If Err.Number > 0 Then
Err.Clear
Application.CommandBars("Workbook Tabs").ShowPopup
End If
On Error GoTo 0
End Sub
Being a VBA novice I was wondering if there was a Word 2003 version that functions in the same or similar way???
I have looked at the Document Map, which is very similar to what I am after but this stays open and reduces screen size.
Is there Word VBA version of the Excel macro that creates a Word VBA version of the Excel macro which creates a popup that lets you select a heading, click on it to go to it and then the popup closes???
Some replies I have had suggested:
Hafizullah suggested:
Perhaps Edit | Go To (Ctrl-G from the keyboard) will meet your needs
In that built-in dialog, you get the choice of Page, Section, Line, Bookmark, Comment, Footnote, Endnote, Field, Table, Graphic, Equation, Object, Heading. and it’s modeless, so you can keep it up if you wish and work behind it.
Bear suggested:
I'd suggest you create a custom userform with a list box to display the headings, select one, and go to it.
If your headings are all Heading styles, then you can use the method GetCrossReferenceItems(ReferenceType:=wdRefTypeHeading) to load the list with all these headings.
If you need to list headings that have a variety of styles, I can't think of any way to develop the list other than by working through the paragraphs collection, determining the paragraph style, and if it's one of the ones you want, adding the text of the paragraph to the list. Of course, the longer your document, the longer this will take.
Once a list item is selected, you can "go to" the heading using the Find method.
Any help or comments appreciated.
Regards,
Dave T
I posted this message in another forum, but the responses are received via individual e-mails, so I thought I’d try a different forum where all replies are in the same place so my apologies if some consider this cross posting.
When I use Excel 2003 I have a macro I use for quick navigation between worksheets within a workbook.
Sub SheetList()
On Error Resume Next
Application.CommandBars("Workbook Tabs").Controls("More Sheets...").Execute
If Err.Number > 0 Then
Err.Clear
Application.CommandBars("Workbook Tabs").ShowPopup
End If
On Error GoTo 0
End Sub
Being a VBA novice I was wondering if there was a Word 2003 version that functions in the same or similar way???
I have looked at the Document Map, which is very similar to what I am after but this stays open and reduces screen size.
Is there Word VBA version of the Excel macro that creates a Word VBA version of the Excel macro which creates a popup that lets you select a heading, click on it to go to it and then the popup closes???
Some replies I have had suggested:
Hafizullah suggested:
Perhaps Edit | Go To (Ctrl-G from the keyboard) will meet your needs
In that built-in dialog, you get the choice of Page, Section, Line, Bookmark, Comment, Footnote, Endnote, Field, Table, Graphic, Equation, Object, Heading. and it’s modeless, so you can keep it up if you wish and work behind it.
Bear suggested:
I'd suggest you create a custom userform with a list box to display the headings, select one, and go to it.
If your headings are all Heading styles, then you can use the method GetCrossReferenceItems(ReferenceType:=wdRefTypeHeading) to load the list with all these headings.
If you need to list headings that have a variety of styles, I can't think of any way to develop the list other than by working through the paragraphs collection, determining the paragraph style, and if it's one of the ones you want, adding the text of the paragraph to the list. Of course, the longer your document, the longer this will take.
Once a list item is selected, you can "go to" the heading using the Find method.
Any help or comments appreciated.
Regards,
Dave T