Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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)
MsgBox(expPth)
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?
Solved it by switching tactics. Ended up with something similar to [the end of] Jacob Berglund's solution on:
http://qlikcommunity.qliktech.com/thread/7593
Would still be interested in whether it is possible to use obj.ExportEx for this...