vba screen snapshot code

P

pat

Hello!
I would like to include into an excel macro programme a vba instruction
to take a full screen snapshot of several displayed worksheets. Anyone
could help ?

Thank you.

Pat.
 
B

Bernard Rey

pat wrote :
I would like to include into an excel macro programme a vba instruction
to take a full screen snapshot of several displayed worksheets. Anyone
could help ?

Search the VBA helpfile for "CopyPicture". I guess that could match your
needs. Could something like this be OK?

Worksheets("Sheet1").Range("A1:H20").CopyPicture xlScreen, xlBitmap
' Worksheets("Sheet1").UsedRange.CopyPicture xlScreen, xlBitmap

Worksheets.Add.Paste
 
J

JE McGimpsey

pat said:
Hello!
I would like to include into an excel macro programme a vba instruction
to take a full screen snapshot of several displayed worksheets. Anyone
could help ?

One way:

Public Sub Screenshot()
Const sPATH As String = "/Users/je/Desktop/"
Const sFILENAME As String = "screenshot.pdf"
Const sSCRIPT As String = _
"do shell script ""screencapture '%%$$'"""
With Application
MacScript (.Substitute(.Substitute( _
sSCRIPT, "%%", sPATH), "$$", sFILENAME))
End With
End Sub

modify with your Path and desired filename...
 
P

pat

Bernard said:
pat wrote :


Search the VBA helpfile for "CopyPicture". I guess that could match your
needs. Could something like this be OK?

Worksheets("Sheet1").Range("A1:H20").CopyPicture xlScreen, xlBitmap
' Worksheets("Sheet1").UsedRange.CopyPicture xlScreen, xlBitmap

Worksheets.Add.Paste
http://faq.office.macintosh.free.fr
Thank you very much for your input and Merry Christmas

Patrick Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top