Showing posts with label macro. Show all posts
Showing posts with label macro. Show all posts
11 June 2012
Qlikview: Macro: How to export multiple objects into excel
By the help of macros, we can export data from multiple objects (table charts, table boxes) into excel.
All we need to do is to pass the Object IDs in the highlighted line of the macro code below and run the macro by a Button.
Pls. note that Current Local Security level (in the edit module screen) should be set to Allow Sytem Access level.
Macro code:
sub launchXL
set oXL=CreateObject("Excel.Application")
oXL.visible=True
oXL.Workbooks.Add
aSheetObj=Array("TB01","CH01")
for i=0 to UBound(aSheetObj)
oXL.Sheets.Add
Set oSH = oXL.ActiveSheet
oSH.Range("A1").Select
Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))
obj.CopyTableToClipboard True
oSH.Paste
sCaption=obj.GetCaption.Name.v
set obj=Nothing
oSH.Rows("1:1").Select
oXL.Selection.Font.Bold = True
oSH.Cells.Select
oXL.Selection.Columns.AutoFit
oSH.Range("A1").Select
oSH.Name=left(sCaption,30)
set oSH=Nothing
next
set oXL=Nothing
end sub
Here is a sample qlikview application: https://sites.google.com/site/quickdevtips/home/excelmacro.qvw?attredirects=0&d=1
Subscribe to:
Posts (Atom)