Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi - I'm trying out a macro I found on this discussion board, but it's not working for me. I have an Input Box with 5 predefined values. I need the input box to reset or clear (show no values) when the user clicks the Clear All button. I've added the following macro as an Action on the Clear All button. It does clear the value in the Input Box, but the Edit Module box keeps opening everytime it runs. I'm not sure what is wrong with the macro. Any suggestions will be appreciated! Thanks--Cat
sub IBclear
'Clear All input boxes
set ClearAllib = ActiveDocument.GetSheetObject("IB10")
ClearAllib.SetVariableContent 0,"",true
ClearAllib.SetVariableContent 1,"",true
ClearAllib.SetVariableContent 2,"",true
ClearAllib.SetVariableContent 3,"",true
ClearAllib.SetVariableContent 4,"",true
' ActiveDocument.ClearAll false
end sub
Check with this macro
sub clear
set v = ActiveDocument.Variables("Variable1")
prop = v.GetProperties
dim list
list=Array("abc","45","xyz","")
prop.PreDefinedList = list
v.SetProperties prop
set ClearAllib = ActiveDocument.GetSheetObject("IB10")
ClearAllib.SetVariableContent 0,"",true
Erase list
list=Array("abc","45","xyz")
prop.PreDefinedList = list
v.SetProperties prop
end sub
To set an empty value for the input box with option predefined values only. you have to include emtpy value in the predefined values. simply semicolon without any chars
Example: ;1;2;3;4;5
Thanks. That is my workaround, however it puts a blank line in my dropdown. I'd like to use a macro to avoid having this extra blank line.
You can go with other option as set any one as default value from the predefined values?
No, there is no default value.
HI
Are you want something like attached file..
Check with this macro
sub clear
set v = ActiveDocument.Variables("Variable1")
prop = v.GetProperties
dim list
list=Array("abc","45","xyz","")
prop.PreDefinedList = list
v.SetProperties prop
set ClearAllib = ActiveDocument.GetSheetObject("IB10")
ClearAllib.SetVariableContent 0,"",true
Erase list
list=Array("abc","45","xyz")
prop.PreDefinedList = list
v.SetProperties prop
end sub
Thank you! This works perfectly.
Quick question, how would I modify this macro to work with input boxes that don't have predefined variables? Just to wipe whatever they happen to have in them. (Sorry I can't chip you points from this string, but level 10 says you're okay unless you're trying to dethrone Gysbert. )