Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Export selected data from a List Box to Excel/QVD through Button?

Hi All,

I have some values selected in a List Box. Now I need to export those selected values to a QVD or an Excel File to a particular location (storage path should be predefined and fixed) with the help of a Button.

Could it be done somehow using Macro or something else?

I used Export as action, but the QVD/Excel is not storing in my desired saved path. Sometimes shows message that the created file can't be overwritten.

Please suggest!

8 Replies
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi All,

Any suggestions please?

My Button need to work fine on Dashboard on Access Point. Users should not see the path to store the QVD/Excel. It should be predefined while creation of button.

Also, is there any way so that, once the Save/Export is complete a Message box should be populated that 'Saving/Exporting Data is Complete'?

Regards!!!

salto
Specialist II
Specialist II

Hi,

adapt this code to your particular case. It is a macro that can be called from your button.:

Sub Export1

ActiveDocument.ClearAll false

pathcorp="F:\"

set corp = ActiveDocument.GetSheetObject("LB01") //Name of your listbox

corp.ExportBiff  pathcorp & "TEST.xls"

set XLApp = CreateObject("EXCEL.application")

XLApp.Visible = FALSE

set XLDoc = XLApp.Workbooks.Add

for i=0 to val.Count-1

set MyTable = ActiveDocument.GetSheetObject("LB01")

path="F:\"

MyTable.ExportBiff  path & val.Item(i).Text &".xls"

   

next

Set XLApp = Nothing

Set Table = Nothing

'Msgbox "Exported Sucessfully"

end sub

Hope this helps.

Anonymous
Not applicable

As for the QVD - it can be "exported" only by reload, using "store":
Store <table name> Into QVDName.qvd (qvd);


montero91
Creator
Creator

Hi

Crea la tabla que quieras exportar y selecciona la carpeta destino, genera un botón y en acciones llama la macro.
Si lo pondras en el access point, recuerda que unicamente las macros funcionan con plugin.

----------
Create the table you want to export and select the target folder, creates a button and call the macro in the actions.
If you put in the access point, remember that macros work only with plugin.

sub ExportaQVD

  set obj = ActiveDocument.GetSheetObject("CH05")

  File = activedocument.Evaluate("QVname.qvd'")

  File2  = "C:\Qlikview\" & File

  obj.ExportEx File2, 4

end sub

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Salto,

Thanks for the help.

Though I don't have experience on Macros, I did tried your script, by changing a bit with my objects. Still I am noticing when I click on the Button created, the Macro script editor opens up, without exporting the selected data.

Could you please post a sample QVW with this implementation?

Regards!

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Victor,

Thanks for the help.

Though I don't have experience on Macros, I did tried your script, by changing a bit with my objects. Still I am noticing when I click on the Button created, the Macro script editor opens up, without exporting the selected data.

Could you please post a sample QVW with this implementation?

Regards!

montero91
Creator
Creator

crea una carpeta "Qlikview" en C:.

Cuando lo abras te preguntará por la seguridad por la ejecucion de macros. dale en permitir macros.

Para ver el codigo es con Ctrl + m.

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi Victor,

Thanks a lot for this.

However noticed one thing.This exact script was not working when I was putting a List box ID. Changed a bit as below:

 

sub Export

set obj = ActiveDocument.GetSheetObject("LB07")
obj.ServerSideExportEx "C:\QlikView\Export.qvd" , ";" , 4 '0=HTML, 1=Text, 2=Bitmap, 3=XML, 4=QVD, 5=BIFF

end sub

Also, could you please help me in getting a message box populating 'Exported Successfully' once the export is done? It is for users purpose only.

Regards!!