Pages

Tuesday, 18 October 2011

Capture Screenshot: Capture and save a PNG of the entire screen.


' =============================================================
' function: ScreenShot
' desc : Creates a png of the entire screen
' params : n/a
' returns : name of saved png
' =============================================================

Function ScreenShot()

 

dim strPNG
dim objDesktop

 

' set a unique file name using the date/time
strPNG = "C:\Screenshot_" & day(date) & month(date) & year(date) & _

                          & hour(time) & minute(time) & second(time) & ".png"

 

' desktop object
Set objDesktop = Desktop

 

' capture a png of the desktop
obj.CaptureBitmap strPNG, true

 

' return the file name
ScreenShot = strPNG

 

' destroy the object
Set objDesktop = Nothing

 

End Function 'ScreenShot


0 comments:

Post a Comment