Take a screenshot

E

Eugene

Hi

I was just wondering is there a chance to take a screenshot in Excel through VBA?
I'm using Office XP running on Windows XP
Appreciate any help

Thanks
Eugene.
 
D

DNF Karran

A shorter version of the code on MSDN that will copy the screen to th
clip board. If you just add the declarations at the start you can the
just add the keybd_event to your code.

Duncan

Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo A
Long)
Public Const VK_SNAPSHOT = &H2C


Sub PrintScreen()
keybd_event VK_SNAPSHOT, 0, 0, 0
End Su
 
D

DNF Karran

''''Print Screen
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo A
Long)
Public Const VK_SNAPSHOT = &H2C
''''End Print Screen

Sub SaveScreen()
Dim gsChart As Chart
keybd_event VK_SNAPSHOT, 0, 0, 0
Set gsChart = ThisWorkbook.Sheets.Add(Type:=xlChart)
ActiveSheet.Paste
gsChart.Export Filename:="C:\ABC", FilterName:="GIF"
End Sub

Will do the jo
 
Top