B
Bill Foley
Hey Gang, Word VBA-Wanna-Be here:
I am creating a large document that I can use to create smaller documents by
bookmarking text. Basically, I want to have four-levels of text that I
bookmark by selecting the paragraph(s), clicking a toolbar button that opens
a UserForm, providing a OptionButton group of the four choices, where you
select the choice, then click OK. That will assign a new bookmark name to
the selected text. For example, a_1, a_2. Selecting other text and
choosing another level will generate bookmarks named b_1, b_2, etc.
Once I have the entire document (actually a template) bookmarked, I save it.
I have an AutoNew macro that opens up another UserForm providing the user
with four options of documents to create. If the user chooses "Level 1", I
want all of the "non-applicable" bookmarks deleted. Assuming Level 1
documents have bookmarks named "a_1", a_2", etc., I would want to get rid of
all the "b, c, and d" bookmarks.
My questions are two fold:
1. How do I use VBA to name bookmarks for level "a" to make them "a_1",
"a_2", etc.? I know how to assign a name itself, but not to add 1 to a
starting point.
2. How would I generate the array, search for all bookmarks "not" like the
chosen one, then delete them?
Thanks in advance!
I am creating a large document that I can use to create smaller documents by
bookmarking text. Basically, I want to have four-levels of text that I
bookmark by selecting the paragraph(s), clicking a toolbar button that opens
a UserForm, providing a OptionButton group of the four choices, where you
select the choice, then click OK. That will assign a new bookmark name to
the selected text. For example, a_1, a_2. Selecting other text and
choosing another level will generate bookmarks named b_1, b_2, etc.
Once I have the entire document (actually a template) bookmarked, I save it.
I have an AutoNew macro that opens up another UserForm providing the user
with four options of documents to create. If the user chooses "Level 1", I
want all of the "non-applicable" bookmarks deleted. Assuming Level 1
documents have bookmarks named "a_1", a_2", etc., I would want to get rid of
all the "b, c, and d" bookmarks.
My questions are two fold:
1. How do I use VBA to name bookmarks for level "a" to make them "a_1",
"a_2", etc.? I know how to assign a name itself, but not to add 1 to a
starting point.
2. How would I generate the array, search for all bookmarks "not" like the
chosen one, then delete them?
Thanks in advance!