Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Create a new *.vbs file: "Sent to Outlook.vbs" and insert below script:
- 2. Then make a shortcut in c:\users\[username]\AppData\Roaming\Microsoft\Windows\SendTo
- ----------------------------------------------------------------
- Option Explicit
- Dim objArgs, OutApp, oNameSpace, oInbox, oEmailItem, olMailItem
- Dim a, oAttachments, subjectStr, olFormatHTML
- olMailItem = 0
- olFormatHTML = 2
- Set objArgs = WScript.Arguments 'gets paths of selected files
- Set OutApp = CreateObject("Outlook.Application") 'opens Outlook
- Set oEmailItem = OutApp.CreateItem(olMailItem) ' opens new email
- For a = 0 to objArgs.Count - 1
- Set oAttachments = oEmailItem.Attachments.Add(objArgs(a))
- subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-(InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
- Next
- If subjectStr = "" then subjectStr = "No Subject "
- oEmailItem.Subject = "Emailing: " & Left(subjectStr, (Len(subjectStr)-2))
- oEmailItem.BodyFormat = olFormatHTML
- oEmailItem.DisplayOption Explicit
- Dim objArgs, OutApp, oNameSpace, oInbox, oEmailItem, olMailItem
- Dim a, oAttachments, subjectStr, olFormatHTML
- olMailItem = 0
- olFormatHTML = 2
- Set objArgs = WScript.Arguments 'gets paths of selected files
- Set OutApp = CreateObject("Outlook.Application") 'opens Outlook
- Set oEmailItem = OutApp.CreateItem(olMailItem) ' opens new email
- For a = 0 to objArgs.Count - 1
- Set oAttachments = oEmailItem.Attachments.Add(objArgs(a))
- subjectStr = subjectStr & Right(objArgs(a),Len(objArgs(a))-(InStrRev(objArgs(a),"\"))) & ", " 'recreates the default Subject e.g. Emailing: file1.doc, file2.xls
- Next
- If subjectStr = "" then subjectStr = "No Subject "
- oEmailItem.Subject = "Emailing: " & Left(subjectStr, (Len(subjectStr)-2))
- oEmailItem.BodyFormat = olFormatHTML
- oEmailItem.Display
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement