6 Replies Latest reply: Apr 3, 2013 4:39 PM by Anup Singh RSS

    Macro

      I want to aexport table from Qlikview dshboard to excel with macro.

      as i have st up chart visibility by using variable vshow and passing chart name by using button so that particular chart get visible.

      Now want to export chart by using one subrutine and calling variable vshow .

      i have tried but its not working,pls suggest if some one have done or any idea to do it.

      Sub ExportExcel

       

      SET excelFile = CreateObject("Excel.Application")

      excelFile.Visible = true

      SET XLDoc = excelFile.Workbooks.Add

      SET XLSheet1 = XLDoc.Worksheets(1)

      ActiveDocument.GetSheetObject("$(vshow)").CopyTableToClipboard true

      XLSheet1.Paste XLSheet1.Range("A1")

       

      excelFile.Visible = True

       

      End Sub

        • Re: Macro
          Erich Shiino

          Did you get any error message?

          The most commom problem is related to security.

           

          You need to enable unsafe macro execution to access Excel and create a new document.

          You can press Ctrl+Shift +M to check you current security level.

           

          You can also set it on the macro module (where you wrote your macro) on the left side of the screen.

           

          Best Regards,

          Erich

            • Re: Macro

                 

              SUB SendToExcel

              set v = ActiveDocument.Variables("vshow")

              strvshow = v.Getcontent.String

              Set XLApp = CreateObject("Excel.Application")

              XLApp.Visible = True

              Set XLWorkbook = XLApp.Workbooks.Add

              Set XLSheet = XLWorkbook.sheets("Sheet1")

              XLSheet.Select

              XLSheet.Range("A1").Value = strvshow

              v.SendToExcel

              END SUB

               

              where vshow variable i used to show and hide chart but above code is not working.

              pls help regarding to fix the issue.

            • Re: Macro
              m w

              This macro will not work unless you are using the IE Plugin client.

               

              Also, it looks like you are trying to use a QlikView variable $(vShow) in the macro.  You need to load the contents of the QlikView variable into a vbscript variable.

              Here is an example from the API Guide:

                   set v = ActiveDocument.Variables("Variable1")

                   strVar = .GetContent.String

                • Re: Macro

                  SUB SendToExcel

                  set v = ActiveDocument.Variables("vshow")

                  strvshow = v.Getcontent.String

                  Set XLApp = CreateObject("Excel.Application")

                  XLApp.Visible = True

                  Set XLWorkbook = XLApp.Workbooks.Add

                  Set XLSheet = XLWorkbook.sheets("Sheet1")

                  XLSheet.Select

                  XLSheet.Range("A1").Value = strvshow

                  v.SendToExcel

                  END SUB

                   

                  where vshow variable i used to show and hide chart but above code is not working.

                  pls help regarding to fix the issue.