Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am new to Qlikview.
I wrote a VB script to write a Table Box in a csv file within Macro Edit Module in Qlikview and doesn't run
Why?
Would you please help me to solve this incident?
Below there are the script for QV and Excel. In Excel, I create a QV application object and included Qlikview 12.0 Type Library.
I am using Qlikview 12.0 Personal Edition.
Thanks!
VB script in QV:
Sub runRScore
' Export the selected patient data to be scored.
Set myTable = ActiveDocument.GetSheetObject("DataSentToR")
myTable.Export (CurrentPath & "//data//ExportFile.csv"), ","
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function CurrentPath()
'Set qvApp = New QlikView.Application
' Set Doc = qvApp.ActiveDocument
Set v = ActiveDocument.GetVariable("vAppPath")
CurrentPath = Replace(v.GetContent.String,"\","/")
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
VB script in Excel:
Sub runRScore()
Set qvApp = New QlikView.Application
Set Doc = qvApp.ActiveDocument
' Export the selected patient data to be scored.
Set myTable = Doc.GetSheetObject("DataSentToR")
myTable.Export (CurrentPath & "//data//ExportFile.csv"), ","
End Sub
Function CurrentPath()
Set qvApp = New QlikView.Application
Set Doc = qvApp.ActiveDocument
Set v = Doc.GetVariable("vAppPath")
CurrentPath = Replace(v.GetContent.String, "\", "/")
End Function
I don't think that your approach will work. Take a look here on the various examples which export mostly to excel (but this could be changed) to get a better idea how the code should look like:
https://community.qlik.com/search.jspa?q=macro+excel+export&type=document
Another useful source for macro-coding is this: Useful Qlikview Macros and of course the APIGuide.qvw within your installation is a great source to statements, parameters and the object-model.
- Marcus
Hi Marcus,
Thanks for your recommendation. Actually, I made two changes in the scripts I originally posted:
Anyway, I've seen some of the post you recommended in your comment and some seems to be interesting and helpful.
Best,
Rafael