PDA

View Full Version : [SOLVED] Offscreen print



SteveBIS
06-29-2015, 06:27 PM
Hi everyone

I have made VBA to take a screenshot of the PrintArea for each of a workbook's 10 worksheets.
Works fine, but it doesn't work off-screen.*

Does anyone know a way to take a screenshot of a tab while Application.ScreenUpdating = False ?
I don't mind if it's a screenshot of a full screen ; it can be cropped to be the Print Area.

So something like :

Sub SS()
Application.ScreenUpdating = False
Dim oCount as Integer

Sheets("before.first.tab").Select
For oCount = 1 to 100
ActiveSheet.Next.Select
ActiveSheet.Range("Print.Area").[screenshot code here]
Next oCount
End Sub

Yes, it might be too much for VBA and Windows.
I gather PrintWindow() can take screenshots of minimized windows, but can't capture areas in an Excel file.


* If it's off-screen, the whole procedure is 10x faster, and can happen in parallel

SamT
06-29-2015, 07:42 PM
You might look at the Range.CopyPicture method.

SteveBIS
06-29-2015, 08:05 PM
Thanks SamT.

Range.CopyPicture snaps the range into the clipboard. Are you able to save from the Clipboard ? I cannot.

SteveBIS
06-29-2015, 08:43 PM
Works a treat once clipboard.dll is registered ; that's what I was missing.

Much appreciated, SamT.