Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I want to come up with a excel macro which will select a tab from a qvw file first and then select a data table in the same and pull the data from that data table to excel worksheet. The qvw file is existing on a portal.
Thanks a lot for your help in advance.[:)]
Hi,
Not sure of doing it from Excel; but the below is the start & end portion of a macro written in Qlikview that is currently working for us; that selects a specific Qlikview tab, then a specific object & pastes it into a specified Excel template. This is also working for us via IE Plugin so maybe you can 'cobble' together what you need from it?
Sub Excel_Table_Export
set XLApp = CreateObject("Excel.Application")
set XLDOC = XLApp.Workbooks.Open ("C:\Templates\Test_Data.xlsx")
XLApp.Visible = True
'this is the qvw tab
set s=ActiveDocument.Sheets("Excel Exports")
ActiveDocument.Sheets("Excel Exports").Activate
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH38").Restore
ActiveDocument.GetSheetObject("CH38").CopyTableToClipboard true
'this is the sheet in Excel
set XLSheet = XLDOC.Worksheets("Sheet1")
XLSheet.Paste XLSheet.Range("A1")
XLSheet.SaveAs "C:\Data & " - " & [mynamevar] & " - " & [mydatevar] & ".xlsx"
set XLApp = Nothing
set XLDOC = Nothing
set XLSheet = Nothing
End Sub
Hope it helps!
Hi,
Not sure of doing it from Excel; but the below is the start & end portion of a macro written in Qlikview that is currently working for us; that selects a specific Qlikview tab, then a specific object & pastes it into a specified Excel template. This is also working for us via IE Plugin so maybe you can 'cobble' together what you need from it?
Sub Excel_Table_Export
set XLApp = CreateObject("Excel.Application")
set XLDOC = XLApp.Workbooks.Open ("C:\Templates\Test_Data.xlsx")
XLApp.Visible = True
'this is the qvw tab
set s=ActiveDocument.Sheets("Excel Exports")
ActiveDocument.Sheets("Excel Exports").Activate
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH38").Restore
ActiveDocument.GetSheetObject("CH38").CopyTableToClipboard true
'this is the sheet in Excel
set XLSheet = XLDOC.Worksheets("Sheet1")
XLSheet.Paste XLSheet.Range("A1")
XLSheet.SaveAs "C:\Data & " - " & [mynamevar] & " - " & [mydatevar] & ".xlsx"
set XLApp = Nothing
set XLDOC = Nothing
set XLSheet = Nothing
End Sub
Hope it helps!
Hi Jon,
Thanks a lot for your reply, But I am looking for a excel macro which can perform the tasks mentioned by me in my initial post. I can use click view code because though I have qlikview installed on my system but the recepients to whom I will send this macro they may or may not have qlikview installed on the system. Actually they may be having only the Internet exlporer plugin installed on there system which allows them to open a qvw file which is available on a portal. So I want to come up with a excel macro which will help them to pull the data from the qvw file which they are able to open on the portal using the plugin.
Thanks a lot for your help in advance.
Hi All,
Did anyone get the chance to look into the above post ?.
Thanks a lot for your help in advance.
You may also dump any table into a txt-file during script-execution, which then can be picked up by Excel (or automated via VB-scripts)
HTH
Peter