Take a screenshot

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
''''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
 

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

Back
Top