Microsoft Office Tutorials and References
In Depth Information
Creating a Bookmark from a Selection
Tip: See the following entry, Creating a Bookmark from a Selection , for a tool to quickly create
bookmarks from text selections.
5. Insert a bookmark named txtStartBody in the location where the user
should start typing once the macro has finished. Deciding not to use a
bookmark simply means that the macro skips selecting that location if a
bookmark isn't present.
6. Feel free to change the form to fit various requirements. Deleting and
adding labels and text boxes won’t detrimentally affect the macro tool.
Just be careful not to delete the buttons.
7. This tool contains an 'AutoNew' procedure so that the form appears
whenever the user creates a new document from the template.
Comment out the procedure if this is unwanted.
8. To make it easy to edit the input at a later time, assign the procedure
'GetUserInput' to a toolbar button. The macro automatically picks up
the bookmarked content when it displays the user form.
Wrd
Creating a Bookmark from a Selection
This procedure creates a bookmark from the current selection in a document
and bases the bookmark name on the selected text.
Example file:
W038
Scenario: Using a macro to place text into a Word
document, whether the text originates from a UserForm, a
database, or an InputBox, requires that a target be specified
in the document. Most often, bookmarks serve as targets.
Bookmarks are also used to mark information for cross-
referencing and generating Tables of Content for specific
parts of a document.
While creating bookmarks is simple enough—select a range
of characters, then Insert | Bookmark, type in a name and
click Insert—it is time-consuming to repeatedly go through
the menu and display the dialog box.
 
Search JabSto ::




Custom Search