Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro

I want to aexport table from Qlikview dshboard to excel with macro.

as i have st up chart visibility by using variable vshow and passing chart name by using button so that particular chart get visible.

Now want to export chart by using one subrutine and calling variable vshow .

i have tried but its not working,pls suggest if some one have done or any idea to do it.

Sub ExportExcel

SET excelFile = CreateObject("Excel.Application")

excelFile.Visible = true

SET XLDoc = excelFile.Workbooks.Add

SET XLSheet1 = XLDoc.Worksheets(1)

ActiveDocument.GetSheetObject("$(vshow)").CopyTableToClipboard true

XLSheet1.Paste XLSheet1.Range("A1")

excelFile.Visible = True

End Sub

6 Replies
erichshiino
Partner - Master
Partner - Master

Did you get any error message?

The most commom problem is related to security.

You need to enable unsafe macro execution to access Excel and create a new document.

You can press Ctrl+Shift +M to check you current security level.

You can also set it on the macro module (where you wrote your macro) on the left side of the screen.

Best Regards,

Erich

m_woolf
Master II
Master II

This macro will not work unless you are using the IE Plugin client.

Also, it looks like you are trying to use a QlikView variable $(vShow) in the macro.  You need to load the contents of the QlikView variable into a vbscript variable.

Here is an example from the API Guide:

     set v = ActiveDocument.Variables("Variable1")

     strVar = .GetContent.String

Not applicable
Author

SUB SendToExcel

set v = ActiveDocument.Variables("vshow")

strvshow = v.Getcontent.String

Set XLApp = CreateObject("Excel.Application")

XLApp.Visible = True

Set XLWorkbook = XLApp.Workbooks.Add

Set XLSheet = XLWorkbook.sheets("Sheet1")

XLSheet.Select

XLSheet.Range("A1").Value = strvshow

v.SendToExcel

END SUB

where vshow variable i used to show and hide chart but above code is not working.

pls help regarding to fix the issue.

Not applicable
Author

   

SUB SendToExcel

set v = ActiveDocument.Variables("vshow")

strvshow = v.Getcontent.String

Set XLApp = CreateObject("Excel.Application")

XLApp.Visible = True

Set XLWorkbook = XLApp.Workbooks.Add

Set XLSheet = XLWorkbook.sheets("Sheet1")

XLSheet.Select

XLSheet.Range("A1").Value = strvshow

v.SendToExcel

END SUB

where vshow variable i used to show and hide chart but above code is not working.

pls help regarding to fix the issue.

sushil353
Master II
Master II

Are you trying to print the variable value in excel sheet??

Not applicable
Author

i am trying to export table data into excel but i want to write only one subprogram for all chart and export which is visible at that time , i have used variable to set visibility of charts.