0

How do I edit line 10 MessageBody = "Test string here, but want to get it from clipboard" of the following VBS script to use the clipboard contents please?

Dim ToAddress
Dim MessageSubject
Dim MessageBody
Dim MessageAttachment

Dim ol, ns, newMail

ToAddress = "xxxxxxxxx.com"  ' Change this to your own address to test
MessageSubject = "Test using VBS"
MessageBody = "Test string here, but want to get it from clipboard"

Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
ns.logon "","",true,false
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf

' validate the recipient, just in case...
Set myRecipient = ns.CreateRecipient(ToAddress)
myRecipient.Resolve
If Not myRecipient.Resolved Then
MsgBox "unknown recipient"
Else
   newMail.Recipients.Add(myRecipient)
   newMail.Send
End If

Set ol = Nothing
Terrypin
  • 1
  • 2

0 Answers0