Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everybody,
I am currently working with multiple hidden buttons laying over a pivot table. For maintainability reasons, I would like to change the transparency of all buttons with one macro. I tried to make a macro, but could not find the method in the API guide.
Can you guys help me out?
The macro I wrote so far:
sub ChangeTransparency
for s = 0 to ActiveDocument.NoOfSheets - 1
set vSheet= ActiveDocument.GetSheet(s)
Objects = vSheet.GetSheetObjects
For i = lBound(Objects) To uBound(Objects)
set vObject = Objects(i)
set vObjectProp = vObject.GetProperties
vOK = 0
'button object...
if vOK=0 AND vObject.GetObjectType = 5 then
' The code for setting the transparency
vOK = 1
end if
vObject.SetProperties vObjectProp
Next
next
end sub
The IButtonProperties class should work.
For Daniel's reply: The button backgroung color can be a calcualted color. That's where you would use the expression.
I haven't used this so this is just a suggestion. Try looking for Alpha or BkgAlpha in the API Guide.
A simpler way would be to use argb($(variabletransparency), R, G, B) function as background color.
Then you can use an action (even simpler than a macro) to change the transparency factor variable.
@mwoolf: The class 'button' does not seem to contain the member 'layout', which is required to use BkgAlpha or Alpha.
@Daniel: Is it possible to use an expression for the background of a button? I cannot find it at the moment.
Thanks for the quick responses so far!
The IButtonProperties class should work.
For Daniel's reply: The button backgroung color can be a calcualted color. That's where you would use the expression.
You can enter an expression there
Thank you guys, I haven't used this api guide before so I had difficulty finding it..
You should really try avoiding Macro's when possible as they have several negative effects.
Look at the attached document.