Tuesday, January 31, 2012

Qlikview Export To Excel Macro

Macro to export based on a column's value
For Every possible values  seperate excel file will be generated.

Sub Export1
ActiveDocument.ClearAll false
pathcorp="F:\TEST\"
set corp = ActiveDocument.GetSheetObject("CH02")
corp.ExportBiff  pathcorp & "TEST.xls"
ActiveDocument.Fields("REGION").Clear
set val=ActiveDocument.Fields("REGION").GetPossibleValues
set XLApp = CreateObject("EXCEL.application")
XLApp.Visible = FALSE
set XLDoc = XLApp.Workbooks.Add

for i=0 to val.Count-1
set MyTable = ActiveDocument.GetSheetObject("CH02")
path="F:\TEST\"
ActiveDocument.Fields("REGION").Select val.Item(i).Text
        MyTable.ExportBiff  path & val.Item(i).Text &".xls"
   
next
Set XLApp = Nothing
Set Table = Nothing

'Msgbox "Exported Sucessfully"
end sub

Click here to download script as txt file 

8 comments:

  1. how can i call this SUB from Script Editor?

    ReplyDelete
  2. We use exportbiff to export to a excel file. How about if i want to export to a txt file?

    ReplyDelete
  3. MyTable..Export "D:\Qlikview\CSVReports\Test.csv", ", "

    ReplyDelete
  4. Is it possible to export multiple charts in single Excel using ExportBiff (which means not by using CreateObject("Excel.Application"))

    ReplyDelete
    Replies
    1. You can use copy objects to excel sheet().however to a new sheet in the same excel.

      Delete
    2. Can you Please elaborate(if possible with sample code/syntax)?

      Thank you.

      Delete
  5. It doesnot work with Publisher. Any idea regarding using a macro fucntion and then calling the actual macro file to call which will have a code for export an excel of any chart ?

    ReplyDelete
  6. Manage your own destiny - TITNIA GARLING TONS - Titanium
    With the power of thorium gallium gallium gallium gallium gallium gallium gallium gallium gallium gallium w88 gallium gallium titanium nipple jewelry gallium titanium 200 welder gallium 2013 ford focus titanium hatchback gallium titanium wood stoves gallium gallium gallium gallium gallium

    ReplyDelete