Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a qlikview application which export certain charts (not image) to excel in different sheets through button (i.e creating a new excel sheet to a specified location), now i have put a macro inside the stored excel file and execute the macro from qlikview.
Can anyone suggest how to put the macro inside the excel file exported from Qlikview and how to run that macro from qlikview.
or how to export those charts to an existing excel file (In which it will delete the previous sheet or value and create the new sheets ) where the macro is already stored.
Thanks.
Regards,
Tom
Not quite sure I follow, however you have the external macro in a batch script, then call that from an Action command within QV - ie. Add Action/External/Open URL (URL to the batch script).
Hi Tony,
write your excel macro code inside a sheet event OnOpen.So it will execute if any one opens that excel file.
Now from qlikview side we can make it open,save and close automatically using vbscript/macro through any trigger.
Please try this,
Sub ExecuteExcel
Dim objXLApp, objXLWb, objXLWs
Set objXLApp = CreateObject("Excel.Application")
Set objXLWb = objXLApp.Workbooks.Open("E:\Docs\Invoice.csv")
objXLWb.Save
objXLWb.Close (False)
Set objXLWs = Nothing
Set objXLWb = Nothing
objXLApp.Quit
Set objXLApp = Nothing
End Sub
Regards
Kumar
Hi Ravi,
Thanks for your comment.
Can you give the steps for sheet event OnOpen.
Regards,
Tom
Hi,
Please look at this example.
Another way to automatically run a macro when you open a workbook is to write a VBA procedure in the Open event of the workbook by using the Visual Basic Editor. The Open event is a built-in workbook event that runs its macro code each time you open the workbook.
The following simple example uses the Open event to run a macro when you open the workbook.
Private Sub Workbook_Open() End Sub
Private Sub Workbook_Open() MsgBox Date Worksheets("Sheet1").Range("A1").Value = Date End Sub
Regards
Kumar