Automating Forwarding

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hello,

Here is what I want to do:

I help administer a list server that uses majordomo commands. When I
get a message that requires me to do a series of tasks, such as
subscribing and unsubscribing users from various lists using e-mail.

So, what I want to do is have a button hooked to a macro/VBA app that
forwards a user's message and inserts this at the top of the message:
which [user's e-mail address]
end

/////rest of their message///

The user's e-mail address is gotten from the original e-mail they send
me. I am a bit new to Inspectors and Explorers, but once I have
knowlege of how to take the aspects of one object and use that to
create another object, then I'll be 90% there.

There are other parts that I can do, once I have the knowlege on how to
do this.

Thanks,

Jeff
 
Here is the code that I am using:
Sub ForwardItem()
Dim oExplorer As Outlook.Explorer
Dim oMail As Outlook.MailItem
Dim oOldMail As Outlook.MailItem

Set oExplorer = Application.ActiveExplorer
If oExplorer.Selection.Item(1).Class = olMail Then
Set oOldMail = oExplorer.Selection.Item(1)
Set oMail = oOldMail.Forward
oMail.Recipients.Add "IP-MajorDomo"
oMail.Recipients.Item(1).Resolve
If oMail.Recipients.Item(1).Resolved ThenoMail.Send
Else
MsgBox "Could not resolve " & oMail.Recipients.Item(1).Name
End If
Else
MsgBox "Not a mail item"
End If
End Sub

Credit for the base code must go to Ken Slovak; I found this at:
http://www.officekb.com/uwe/Forum.aspx/outlook-prog-addins/747/Macro-to-forward-email

The code fails at the line that has the >>>> at the beginning.

OK, now here is the problem I am having now:
When I look at oOldMail, it contains no variables! Shouldn't this have
the attributes of the Original e-mail that is being forwarded? I want
to get the from, and eventually get the subject put in there as well.

What am I missing in understanding of Outlook selection obects?

Jeff
Hello,

Here is what I want to do:

I help administer a list server that uses majordomo commands. When I
get a message that requires me to do a series of tasks, such as
subscribing and unsubscribing users from various lists using e-mail.

So, what I want to do is have a button hooked to a macro/VBA app that
forwards a user's message and inserts this at the top of the message:
which [user's e-mail address]
end

/////rest of their message///

The user's e-mail address is gotten from the original e-mail they send
me. I am a bit new to Inspectors and Explorers, but once I have
knowlege of how to take the aspects of one object and use that to
create another object, then I'll be 90% there.

There are other parts that I can do, once I have the knowlege on how to
do this.

Thanks,

Jeff
 
OK, I got it to work... Looking at the properties of the olMail item,
I see that the property needs to be oOldMail.SenderEmailAddress.
Changing it to that solved my problem.

Believe it or not, thanks to all of you for your help. (I put that
introductory phrase in there because I was the only one on this thread,
but I used the collective knowledge of the group to solve this one.)

Jeff
 
Back
Top