Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Store Table Box into QVD using Macro Button

Hello Master,

How to store a table box into qvd using action macro in button ?
I tried script like below :

sub StoreTB01TableToQVD
set obj = ActiveDocument.GetSheetObject("TB01")
File = ActiveDocument.Evaluate("TB01.qvd")
obj.Export File, 4
end sub

When I click test in the macro window, popup appear 'Cannot open file - for writing'

What should I do?

Thank you for you suggestion

3 Replies
Highlighted
Specialist
Specialist

Try

Sub QVDExport
set st = ActiveDocument.GetSheetObject("TB01")
File = activedocument.Evaluate("'Path\table.qvd'")
st.Export File, 4
End Sub

 

Highlighted
Contributor III
Contributor III

Thanks @vamsee 

I tried your suggestion, qvd successfully generated
But, when I opened it, in QlikView for data loading
The separator became wrong, please see my attachment

Is there any other parameter in function Export, to set the separator?

Thanks a lot

Highlighted
Specialist
Specialist

Honestly, I am not an expert on Macros. I tried searching in the community and couldn't find the exact solution.

Basically, that export is missing the XML header part.

vamsee_0-1591285595199.png

 

Alternatively, you can export the complete table box into an XML file and then read it.

 

sub xml
set table= ActiveDocument.GetSheetObject("TB01")
table.ExportXml "Desktop\table.xml"
end sub

 

 

I have tried exporting chart objects into qvd and that worked fine

 

sub ChartToQVD
set obj = ActiveDocument.GetSheetObject("CH01")
obj.ExportEx "Desktop\chart.qvd", 4
end sub