5 Replies Latest reply: Mar 2, 2018 4:12 AM by Tamil arasu RSS

    Set actions via Macro

    Prince Sabi

      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?

        • Re: Set actions via Macro
          Tamil arasu

          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