123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Send Outlook message from script

--------------------------------------------------------------------------------

Description : This allows you to fill out and send an Outlook message from script. Uncomment 2 lines to create a sub that can be included in a larger script. Great for admins who routinely send reports.

'**************************************
' Name: Send Outlook message from script
'
' Description:This allows you to fill ou
' t and send an Outlook message from scrip
' t. Uncomment 2 lines to create a sub tha
' t can be included in a larger script. Gr
' eat for admins who routinely send report
' s.
'
' Inputs:The script, as shown, is all ha
' rdcoded, but you could easily call "inpu
' tbox", or read inputs off a form to fill
' in the items. If you need help adapting
' this to your needs, let me know - I'm ha
' ppy to help you customize it.
'
' Returns:You can choose to preview by u
' sing the .display, or send without previ
' ew by using .send
'
' Assumes:As with all .vbs scripts, you
' must have the scripting runtime. You als
' o need Outlook installed.
'
'Uncomment the sub and
'end sub lines to use this in a program.
'
'Leaving these commented will allow you
'
'to run this as a standalone script
'sub SendAttach()
'Open mail, adress, attach report
Dim objOutlk 'Outlook
Dim objMail 'Email item
Dim strMsg
Const olMailItem = 0
'Create a new message
Set objOutlk = CreateObject("Outlook.Application")
Set objMail = objOutlk.createitem(olMailItem)
objMail.To = "t_a_r@email.msn.com"
objMail.cc = "" 'Enter an address here To include a carbon copy; bcc is For blind carbon copy's
'Set up Subject Line
objMail.subject = "I saw your code On Planet Source Code on " & CStr(Month(Now)) & "/" & CStr(Day(Now)) & "/" & CStr(Year(Now))
'Add the body

strMsg = "Your code rocks!" & vbCrLf
strMsg = strMsg & "I voted and gave you an excellent rating!"
'To add an attachment, use:
'objMail.attachments.add("C:MyAttachmentFile.txt")
objMail.body = strMsg
objMail.display 'Use this To display before sending, otherwise call objMail.Send to send without reviewing
'Clean up
Set objMail = Nothing
Set objOutlk = Nothing
'end sub

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG