Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003

    Question Unanswered: Filling the FROM field in Outlook with VBA-code


    Can somebody tell me how I can fill in the FROM field in Outlook using VBA-code? I know it is possible to fill the fields subject, to, body,... but I cannot find filling the From field.

    Thanx for helping me out!!

  2. #2
    Join Date
    Nov 2002
    Sacramento, CA

    Arrow Try this....

    Function Emailer()

    Dim iMsg
    Dim iConf
    Dim Flds
    Dim strHTML

    Const cdoSendUsingPort = 2

    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields

    'Set the CDOSYS configuration fields to use port 25 on the SMTP server.
    'Do not change these. I'm not sure what they do, but it doesn;'t work without them

    With Flds
    .Item("") = cdoSendUsingPort
    .Item("") = "your server here"
    .Item("") = 10
    End With

    'Build HTML for message body.
    strHTML = "<HTML>"
    strHTML = strHTML & "<HEAD>"
    strHTML = strHTML & "<BODY>"

    'HTML Code for message body

    strHTML = strHTML & "</HTML>"

    'Apply the settings to the message.
    With iMsg
    Set .Configuration = iConf
    .To = ""
    .From = ""
    .Subject = EmailSubject
    .HTMLBody = strHTML
    .Send 'can be changed to .display is you want to view it first
    End With
    Last edited by dragracer; 02-18-03 at 13:31.

Posting Permissions

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