Hallo liebe VBA-Kollegen,
Ihr habt hier ein super Forum! Ich möchte gern ein VBA-Code erstellen, welches einen Printscreen meines aktuellen Bildschirms erstellt und dann in einem Bild speichern. Ich habe im Netz ein super Code gefunden, welches genau dies macht aber dann leider in die Zwischenablage und in Word kopiert. Ich hätte es gern, dass das Bild in Paint geöffnet wird und dann automatisch gespeichert wird. Vielen Dank für eure Hilfe. Sandra
Sub Sample()
Dim IE As Object
Dim hwnd As Long, IECaption As String
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "www.Google.com"
Sleep 5000
'~~> Get the caption of IE
IECaption = "Google - Internet Explorer"
'~~> Get handle of IE
hwnd = FindWindow(vbNullString, IECaption)
If hwnd = 0 Then
MsgBox "IE Window Not found!"
Exit Sub
Else
'~~> Maximize IE
ShowWindow hwnd, SW_SHOWMAXIMIZED
End If
Sleep 3000
DoEvents
'~~> Take a snapshot
Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
'~~> Start Word
Set wordobj = CreateObject("Word.Application")
Set objDoc = wordobj.Documents.Add
wordobj.Visible = True
Set objSelection = wordobj.Selection
'Paste into Word
objSelection.Paste
End Sub
|