Results 1 to 2 of 2

Thread: [RESOLVED] Create Email + Outlook

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Resolved [RESOLVED] Create Email + Outlook

    Hi All,

    I am looking for a vb script that opens the compose a new email window within Outlook, but has the "TO" field populated with a predefined list of recipients.

    Is there is simple script to accomplish this? Thank you all in advance!
    Last edited by Giraffe Frenzy; Dec 20th, 2007 at 01:16 PM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Re: Create Email + Outlook

    I figured it out. I capitalized on a flag MS incorporated into the outlook.exe file.

    For this example, I have a text file with emails listed within it:

    Example of data within the text file:

    Here is the code:
    Code:
    Const ForReading = 1
    
    Set objApp = CreateObject("WScript.Shell")	
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("C:\emails.txt", ForReading)
    
    Do Until objFile.AtEndOfStream
    	strLine = objFile.Readline
    	strLine2 = strLine & "; " & objFile.Readline    
    Loop
    
    objApp.Run Chr(34) & "C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE" & chr(34) &  " /c ipm.note /m " & Chr(34) & strLine2 & Chr(34)
    The code opens a new email message within Outlook, and then sets focus on the subject line.

    I have tested this with Outlook 2007. I am not sure if it will work for Outlook 2003 or earlier.

    Thanks everyone!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width