Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2013 14:10
Show Gist options
  • Save anonymous/68f74fe8c829c4e3ddbc to your computer and use it in GitHub Desktop.
Save anonymous/68f74fe8c829c4e3ddbc to your computer and use it in GitHub Desktop.
Copy current message in Outlook into Windows clipboard
Dim oe
Dim mi
Dim strMH
Set myOlApp = WScript.CreateObject("Outlook.Application")
Set oe = myOlApp.ActiveExplorer
If oe.Selection.Count = 1 And oe.CurrentFolder.DefaultItemType = olMailItem Then
Set mi = oe.Selection.Item(1)
strMH = "From:" & vbTab & mi.SenderName & vbCrLf & _
"Sent:" & vbTab & mi.SentOn & vbCrLf & _
"To:" & vbTab & mi.To & vbCrLf & _
"Cc:" & vbTab & mi.Cc & vbCrLf & _
"Sub:" & vbTab & mi.Subject & vbCrLf & vbCrLf
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.document.parentwindow.clipboardData.SetData "text", strMH & mi.Body
objIE.Quit
WScript.echo "Nachricht im Clipboard: " & mi.subject
Else
WScript.echo "Select one and ONLY one message."
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment