Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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
For single report could be
Sub AllReports1
ActiveDocument.GetSheetObject("CH01").ExportBitmapToFile "C:\Users\asamineni\Downloads\test.jpg"
End Sub
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.
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 !!
it's not for customer
and i need to process all of them not manually, but automatically in the loop.
Hi Андрей,
Have a look at the attached file.
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
Too fast, Is that working?
Thanks! Great!