Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Macro to create & export screenshots of all sheets

Hi everyone!

I'm looking through community threads to find example of the macro which can export to some directory screenshots (jpegs with sheet ID's preferably) of all document sheets.

Anyone knows how to implement this? Will be glad for example/link/advice!

Thanks.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Great, now tell me what loop you are going to have? Can you come up with explanation to understand better.

Well, Try this way to loop each

Sub Export

vPath = "C:\Users\asamineni\Downloads\"

for i = 1 to ActiveDocument.NoOfSheet

ActiveDocument.Sheets(ActiveDocument.GetSheet(i).GetProperties.SheetId).Activate

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.GetSheetByID(ActiveDocument.GetSheet(i).GetProperties.SheetId).ExportBitmapToFile vPath & ActiveDocument.Sheets(i).GetProperties.Name & ".png"

next

ActiveDocument.Sheets(1).Activate

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

11 Replies
Anil_Babu_Samineni

May be this?

Sub AllReports

ActiveDocument.GetSheetByID("SH01").Activate

ActiveDocument.GetApplication.WaitForIdle 1500

ActiveDocument.GetSheetByID("SH01").ExportBitmapToFile "C:\Users\asamineni\Downloads\pic.png"

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

For single report could be

Sub AllReports1

ActiveDocument.GetSheetObject("CH01").ExportBitmapToFile "C:\Users\asamineni\Downloads\test.jpg"

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Great!
Do you know the approach how to do this without hardcode?

I mean if i have 100 sheets and what i need -> export all of them without defining in script what sheet i need to export and what name final png should have.

Anil_Babu_Samineni

That not make sense to me when you have 100 sheets, Because all are over loaded only with in the image as we have 1024*986 resolution. If you still want to force that i didn't prefer because end customer may won't like !!

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

it's not for customer

and i need to process all of them not manually, but automatically in the loop.

tamilarasu
Champion
Champion

Hi Андрей,

Have a look at the attached file.

Anil_Babu_Samineni

Great, now tell me what loop you are going to have? Can you come up with explanation to understand better.

Well, Try this way to loop each

Sub Export

vPath = "C:\Users\asamineni\Downloads\"

for i = 1 to ActiveDocument.NoOfSheet

ActiveDocument.Sheets(ActiveDocument.GetSheet(i).GetProperties.SheetId).Activate

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.GetSheetByID(ActiveDocument.GetSheet(i).GetProperties.SheetId).ExportBitmapToFile vPath & ActiveDocument.Sheets(i).GetProperties.Name & ".png"

next

ActiveDocument.Sheets(1).Activate

End Sub

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

Too fast, Is that working?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Thanks! Great!