Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exporting sheets in jpg and run macro after reload

Hi all.

I have the following macro that I hope works for exporting sheets in a jpg after that the scripts has been reloaded."

Sub Test 

 

          ActiveDocument.Sheets("SH01").Activate 

          ActiveDocument.GetApplication.WaitForIdle 

          ActiveDocument.Sheets("SH01").ExportBitmapToFile "D:\QV_Data\Development\SH01.jpg" 

   

          'ActiveDocument.Sheets("SH02").Activate 

          'ActiveDocument.GetApplication.WaitForIdle 

          'ActiveDocument.Sheets("SH02").ExportBitMapToFile "D:\QV_Data\Development\SH02.jpg" 

 

          'ActiveDocument.Sheets("SH03").Activate 

          'ActiveDocument.GetApplication.WaitForIdle 

          'ActiveDocument.Sheets("SH03").ExportBitMapToFile "D:\QV_Data\Development\SH03.jpg" 

 

End Test

To execute the macro from the script I have tried with "LET _var = Test(1);" but it doesn't work.

Is there anyone that have any suggestions?

Thanks in advance!

1 Reply
marcus_sommer

There is within the script-execution no ActiveDocument because this will only created after script-execution - this must triggered per gui-event or per batch-run. Also ActiveDocument.Sheets needs the sheet-name and not the sheet-id - see APIGuide.qvw:

ActiveDocument.Sheets("Main").ExportBitmapToFile "C:\MyImage.bmp"

- Marcus