11 Replies Latest reply: Sep 2, 2013 5:58 AM by Karthikeyan S RSS

    VBS script problem with excel file saving

      Hi all,


      I'm trying to create to export a report in excel file by VBS macro and save it automatically in a particular folder..actually I´m able to create the file excel but i have always problem in saving it.


      here the piece of code I use for saving the file


      Const xlWorkbookNormal = -4143 '// Excel compatibility mode

      Const xlWorkbookDefault = 51 '//Excel 2007

      Dim fileName 'as String

      fileName = "C:\Desktop\NEW QLIKVIEW PRJ\test.xls"

      on error resume next

      Call objExcelWorkbook.SaveAs(fileName,xlWorkbookDefault) '// or use xlWorkbookNormal

      if (len(Err.Description) > 0) then

                      msgbox("Error Saving Excel" & Chr(13) &  Err.Description & Chr(13) & Err.Source)

      end if

      on error goto 0


      In attachment you can find the entire script,

      Can someone tell me please

      - where is the error?

      - in which point of script have to insert this?

      - do you know a macro for making the same stuff but to export the file in pdf?

      Thanks to all in advance for help!