1 Reply Latest reply: Sep 2, 2011 7:52 AM by Jerry Svensson RSS

    Run export macro using Accesspoint

      Hi All,

       

      I have created a Qlikview document which uses a macro to save out some variables to an excel spreadsheet.

       

      It works fine when used in the Qlikview client, but will not work when used from AJAX over the server.

       

       

      The spreadsheet which is used to save the data into is located on the Qlikview server itself and all paths are referenced correctly.

       

       

      Any ideas how to get this macro to work?

       

      Thanks

      Dan

       

       

      My macro code:

       

       

       

      Sub SaveToExcelSheet


      'Define file paths

      f_name = "\\wapp07\supply$\maximo\Security2.xls"

      Set oXL = CreateObject("Excel.Application")
      Set oWB = oXL.Workbooks.Open(f_name)
      Set oSH = oWB.Worksheets("Data")

       

      'Copy the qlikview input variables into VB variables

      Set VB_DATE = ActiveDocument.Variables("V_DATE")

      'Discover the next empty row in the excel file

      VB_NEXTEMPTYROW = oXL.WorksheetFunction.CountA(oSH.Columns("A:A"))

       

      'Save out the variables into the empty row

      oSH.Cells(VB_NEXTEMPTYROW +1 ,1).Value = VB_DATE.GetContent.String

      'Save and close the excel file in the background

      oWB.Save
      oWB.Close
      oXL.Quit


      End Sub