2 Replies Latest reply: Jul 5, 2017 3:09 AM by Mike Seisbye RSS

    Macro stopped working

    Mike Seisbye

      I have snatched this loop macro out on the great www.   and combined it with an export macro.  I have created a button with the run macro command.  Last month when I created this it worked perfectly.. Now suddenly i can't make it execute.   If i run the export macro on it's own. it's working fine.  so it must be the loop which is of somehow.   But have can it's suddenly stop working?  ( i have checked that allow system access is granted).  Are there other places where you by mistake can disable the security in qlik, so it dosn't work


      The loop looks in the table i'm loading seperatly. i have made a listbox of all the values in it. it then selects the first. export, select next export etc.


      What is wrong.  the code or some kind of security..  I'm almost 100% sure no one has altered the code. i have tried copying from new.  Checking the spelling of the macro name, the field name etc.


      Sub Loops



      MaxRow =  ActiveDocument.Variables("vNoofrows").GetContent.Value



      For x = 0 to MaxRow



          set mySelections = ActiveDocument.fields("Selection").GetSelectedValues(1)


          if mySelections.Count = 0 then

        set val=ActiveDocument.Fields("Selection").GetPossibleValues(1)

        ValueToSelect = val.Item(0).Text


      set val=ActiveDocument.Fields("Selection").GetPossibleValues

      IamDone = " "

      for i=0 to val.Count-1

      ValueToSelect = val.Item(i).Text

      if IamDone = "X" then

      exit for

      end if


      if val.Item(i).Text = mySelections.Item(0).text then

      IamDone = "X"

      end if


      'Call exportToExcel_Variant2




        end if

         ActiveDocument.Fields("Selection").Select ValueToSelect



      Call exportToExcel_Variant2





      End Sub