1 Reply Latest reply: Jan 5, 2012 8:31 AM by Henrik Larkander RSS

    obj.ExportEx  path from variable

      Trying to build a sub that exports a chart to an Excel file, where the user can choose the name and path to said file.


      I have the following code (VBScript):




      sub ExportToExcel()
                      dfltWy = ActiveDocument.Variables("Default_Path").GetContent.String
                          dfltNm = ActiveDocument.Variables("Default_FileName").GetContent.String
                                 pthWy =inputBox("Choose Path",,dfltWy)
                                  flNm = inputBox("Choose Name",,dfltNm)
                           ActiveDocument.Variables("Path").SetContent pthWy, true
                           ActiveDocument.Variables("File_Name").SetContent flNm, true
                           expPth = chr(34)&pthWy&flNm&chr(34)
                                  set obj = ActiveDocument.GetSheetObject("CH07")
                           obj.ExportEx  expPth, 5           'it works fine 'til here. The MsgBox displays the correct path "C:\User\QlikView\Project\Default.xls"
                                                                                 '(including quotations), but no file is created. 
              '            obj.ExportEx  "C:\User\QlikView\Project\Default.xls", 5      ' <-<-<- this works as a check  
      end sub


      Any ideas on how I can get the obj.ExportEx to export according to the expPt variable?