Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paul_ripley
Creator III
Creator III

Macro to Export a chart to excel and save to a folder on reload

Hello

I would like to export a chart on reload to a folder and have this in excel (so that the excel file can be used by another app)

I have found some code from another thread but it appears to stop at 'ActiveDocument.Sheets("SH01" ).Activate

I am not very good with Macros, so if anyone could help me understand why the macros would not export to the folder or suggest improvements, that would be much appreciated.

The code is below

Sub ExportFile

ActiveDocument.Sheets("SH01").Activate

set obj1 = ActiveDocument.GetSheetObject("CH109")
obj1.ExportBiff "\\DCL1-QLIK-WV03\QlikView_UDA\III_LIVE\FIN\01_SOURCE_DATA\XLS\TotalAllocs.xls"

ActiveDocument.GetApplication.Sleep 5000

End Sub

Many thanks

Paul

1 Solution

Accepted Solutions
andrey_krylov
Specialist
Specialist

Hi Paul. There is no need to activate a sheet for export

Sub ExportFile

     set obj1 = ActiveDocument.GetSheetObject("CH109")
     obj1.ExportBiff "\\DCL1-QLIK-WV03\QlikView_UDA\III_LIVE\FIN\01_SOURCE_DATA\XLS\TotalAllocs.xls"

     ActiveDocument.GetApplication.Sleep 5000

End Sub

and qmc does not execute macros

View solution in original post

2 Replies
andrey_krylov
Specialist
Specialist

Hi Paul. There is no need to activate a sheet for export

Sub ExportFile

     set obj1 = ActiveDocument.GetSheetObject("CH109")
     obj1.ExportBiff "\\DCL1-QLIK-WV03\QlikView_UDA\III_LIVE\FIN\01_SOURCE_DATA\XLS\TotalAllocs.xls"

     ActiveDocument.GetApplication.Sleep 5000

End Sub

and qmc does not execute macros

paul_ripley
Creator III
Creator III
Author

HI Andrey

That did work.

I will log another question in a minute as I am trying to get triggers to work so that on reload they run macro

Thanks for your help

Paul