0 Replies Latest reply: May 28, 2014 7:25 AM by David Evans RSS

    Macro called from script not working - can anyone help ?

    David Evans

      I have a macro function that returns the tab names separated by commas.

       

      function TabNames ()

           docprop = Activedocument.GetProperties
           ArrayScript = split(docprop.Script,"///$tab ")

       

           For i=1 to Ubound (ArrayScript)
                TabDetails = split (ArrayScript(i), chr (13))

       

                if i > 1 then
                     TabNames = TabNames & "," & TabDetails (0)
                else
                     TabNames = TabDetails (0)
                end if
           next
      end function

       

      This works fine in 'test' mode but it fails when I call it from the script. If I narrow it down:

       

      This works and returns 'Test Worked'

       

      function TabNames ()
          TabNames = "Test worked"
      end function

       

      This fails and returns blank

       

      function TabNames ()
           docprop = Activedocument.GetProperties
           TabNames = "Test worked"
      end function

       

      So it's the docprop = Activedocument.GetProperties that causes it to fail. Can anyone help ? I am running the macro with system access/allow system access and it still doesn't work.