Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
louwriet
Creator
Creator

assign bookmark value to variable in macro

Hi ,

I would appreciate it if someone can assist me with two issues that i am struggeling with bookmarks.

The first one is that i have some bookmarks of groups of products. The problem that i have is when a user select a bookmark it shows the correct selection of products but as soon as the user select a territory or more that one territory the name of the bookmark is not displayed in the bookmark object although the product grouping is still selected that is correct. To explain my situation see to images below. Am i missing a setting somewhere ? The problem i have this confuses the users, is there a way that i can force the bookmark name to remain there until another bookmark is selected or clear is selected ?

bookmark3.JPG

bookmark2.JPG

My second issue is in a macro where i create the excel report. After the user make selections the user press a button that generates excel reports for them. The reporting works fine and i am using the territories to loop through and create a report per territory. While i loop through i am assigning the territory name in the macro to a variable that i use as the name of the report together with  a timestamp. What i want to do is to use the bookmark name also in the macro as part of the report name, but how do i assign a selected bookmark to a variable in the macro ? i want to use the bookmark name not the id.

below is how i loop through the territory to get the territory name

Set
val=ActiveDocument.Fields("Territory").GetSelectedValues



for i=0 to val.Count-1

''msgbox(val.Count.Text)

    ''''' msgbox(val.Item(i).Text)

 
ActiveDocument.Fields("Territory").Select val.Item(i).Text

Thank so much

Louw

0 Replies