Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need some help in qlikview.I will try to explain it to the best of my understanding:
I have a .qvw file which contains a some data.I have written a code to export that data from that qvw file to an Excel sheet.To export the data to an excel i have created a button(export) which when clicked calls the below given macro(
Excel_Table_Export
) and exports the data to the mentioned excel sheet.It is working fine.
Function Table(box,sheet,size)
ActiveDocument.Sheets(sheet).Activate
set tablebox = ActiveDocument.GetSheetObject(box)
tablebox.CopyTableToClipboard true
XLSheet.Paste XLSheet.Range(size)
End function
Sub Excel_Table_Export
set XLApp = CreateObject("Excel.Application")
XLApp.Visible = True
set amit = ActiveDocument.GetSheetObject
set XLDOC = XLApp.Workbooks.Open ("C:\Complete_Sample.xlsm")
set XLSheet = XLDOC.Worksheets("RA Summary")
call Table("CH502","RA Details - Switch","B5")
call Table("CH503","RA Details - Switch","D8")
call Table("CH504","RA Details - Switch","D11")
set XLApp = Nothing
set XLDOC = Nothing
set XLSheet = Nothing
End Sub
What i want to achieve is:
On this qvw file we have 2 buttons. "Default" and "Current Open".
Currently to export the data to an excel i first select the "default" button on the qvw file and then click on "export" button.This copies all the data to complete_Sample.xlsm file.
But i need to use the same piece of code to run for "current open" also.The only difference should be that when i click on "current open" and then i click on "export" button all the data should be exported to some other excel file.lets say that the file is "current_open.xlsm".
what i thought was to copy the same code with some other name and create to buttons on the qvw file pointing to respective macro.
but that is not the correct way of doing it as i will have to copy the same code with only diff that the filename of the excel sheet will be different.
How to achieve this without the redundant code???????
some way in which it calls two different excel sheet based on the selection of "default" and "current open" button.
can anyone please help me with this....