Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Macro Set Variable wont work

Hi,

i want a click on a table to open another hidden sheet. Wrote the following macro:

ActiveDocument.Sheets("Qualität").Activate

set Q = ActiveDocument.Variables("vAdmin_Themensteuerung")

The first command works but it wont assing 'Q' to the variable.

What am i doing wrong?

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi tresesco,

yup, that works. I then switched the order to:

set v = ActiveDocument.Variables("vAdmin_Themensteuerung")

v.SetContent "Q", true

ActiveDocument.Sheets("Qualität").Activate

and that works too. Dont know why the order is critical but now it works. Thank You!

View solution in original post

4 Replies
sbaldwin
Partner - Creator III
Partner - Creator III

Hi are you missing the set bit ie:

Q.SetContent "Q", true

in the code above Q is the variable object in the script not the value.

Anonymous
Not applicable
Author

Hi Steve,

added the line like this:

ActiveDocument.Sheets("Qualität").Activate

set Q = ActiveDocument.Variables("vAdmin_Themensteuerung")

Q.SetContent "Q", true

but it wont work either.

tresesco
MVP
MVP

Try with only the bottom two lines. Does it work?

Anonymous
Not applicable
Author

Hi tresesco,

yup, that works. I then switched the order to:

set v = ActiveDocument.Variables("vAdmin_Themensteuerung")

v.SetContent "Q", true

ActiveDocument.Sheets("Qualität").Activate

and that works too. Dont know why the order is critical but now it works. Thank You!