17 Replies Latest reply: Sep 16, 2014 9:17 AM by Gatis Burnovskis RSS

    Macro Troubleshooting

    Mark Munich

      Hello community,


      I am running a macro in my qlikview document and i have a Trigger on a button.


      I have the following code in the macro module:


      This works fine when i click on the test in the edit module console, but it doesnt work when i click on the button, I have also made Setting in the document properties Macro override security and also in macro edit module I have set requested module securit to System Access and also current local security. Is there any mistake in this process. btw i got this code from the community. what is this SUB callexample after the function. Do i Need to replace it with my qvw document Name or just leave it as it is.



      FUNCTION ExcelExport(objID)


        set obj = ActiveDocument.GetSheetObject( objID )


        w = obj.GetColumnCount


        if obj.GetRowCount>1001 then




        else h=obj.GetRowCount


        end if


        Set objExcel = CreateObject("Excel.Application")






        objExcel.Visible = True


        set CellMatrix = obj.GetCells2(0,0,w,h)


        column = 1


        for cc=0 to w-1


         objExcel.Cells(1,column).Value = CellMatrix(0)(cc).Text


         objExcel.Cells(1,column).EntireRow.Font.Bold = True


         column = column +1




        c = 1


        r =2


        for RowIter=1 to h-1


          for ColIter=0 to w-1


            objExcel.Cells(r,c).Value = CellMatrix(RowIter)(ColIter).Text


            c = c +1




         r = r+1


         c = 1








      SUB CallExample


         ExcelExport( "CH06" )


      END SUB