Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert output from sendkey into email message body

Status
Not open for further replies.

topjimmie

IS-IT--Management
Feb 4, 2002
28
US
My scripting ability is limited. I have an application running in the background that will generate AND INSERT a string into a text editor or field when a key sequence is entered, e.g. I open notepad and press the key sequence, the result is the string.
I also have a simple script for generating an email via outlook. What I need help with is how to use sendkey method to put the resulting string into the body of the message. (the message body would be the result of SendKeys "%+a")
Here is the email script:

Code:
Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim MessageBody
Dim ol, ns, newMail
ToAddress = "name@address.com"
MessageSubject = "test message"
MessageBody = "string"
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf
newMail.RecipIents.Add(ToAddress)
newMail.Send
SET OL = NOTHING
SET NS = NOTHING
SET NEWMAIL = NOTHING

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top