Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey! Via a macro i create textboxes. Now what i want to do is, to set also certain actions for this created textboxes like on click on the textbox it should set a value for a variable or run a macro. Is it possible to give the textbox such instructions?
Macro Action:
Sub Test
set MyText = ActiveDocument.ActiveSheet.CreateTextObject
set prop = MyText.GetProperties
set TextActions = prop.Layout.ActionItems
TextActions.Add
TextActions.Item(0).Type=13
set ActionParam=TextActions.Item(0).Parameters
ActionParam.Add
ActionParam.Item(0).v="Test"
MyText.SetProperties prop
End Sub
Variable Action:
Sub Test
Set MyText = ActiveDocument.ActiveSheet.CreateTextObject
set prop = MyText.GetProperties
set TextActions = prop.Layout.ActionItems
TextActions.Add
TextActions.Item(0).Type=31
set ActionParam=TextActions.Item(0).Parameters
ActionParam.Add
ActionParam.Item(0).v="Test"
ActionParam.Add
ActionParam.Item(1).v="0"
MyText.SetProperties prop
End Sub
Hey! Thank you this is exact this, what im looking for. How i can add this two actions within a sub? tamilarasu
Hi Prince,
Here is the code.
Sub Test
set MyText = ActiveDocument.ActiveSheet.CreateTextObject
set prop = MyText.GetProperties
set TextActions = prop.Layout.ActionItems
TextActions.Add
TextActions.Item(0).Type=13
set ActionParam=TextActions.Item(0).Parameters
ActionParam.Add
ActionParam.Item(0).v="Macro_Test"
''''MyText.SetProperties prop
TextActions.Add
TextActions.Item(1).Type=31
set ActionParam= TextActions.Item(1).Parameters
ActionParam.Add
ActionParam.Item(0).v= "Variable_Test"
ActionParam.Add
ActionParam.Item(1).v="0"
MyText.SetProperties prop
End Sub
Thank you! U are the best!
Have a nice day and happy weekend, Prince.