Re: Get address from body of message macro ?
From: Michael Bauer (mib00_at_t-online.de)
Date: 03/15/05
- Next message: Luc P Maes: "RE: COM AddIN Not loading"
- Previous message: Michael Bauer: "Re: Macro for using "Add Sender to Blocked Senders List" on multiple email messages simultaneously"
- In reply to: Stacy: "Re: Get address from body of message macro ?"
- Next in thread: Stacy: "Re: Get address from body of message macro ?"
- Reply: Stacy: "Re: Get address from body of message macro ?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 17:32:33 +0100
Hi Stacy,
this returns a reference on the first selected item in a mail folder
(assuming it´s really a MailItem) and writes its body (content) to your
variable:
Dim oMail as Outlook.MailItem
Set oMail = Application.Session.ActiveExplorer.Selection(1)
SearchString1 = oMail.Body
--
Viele Grüße
Michael Bauer
"Stacy" <stacy@123.com> wrote in message
news:#KMVSmXKFHA.3336@TK2MSFTNGP10.phx.gbl...
> I have writen the following code based the advice given here. (Please
dont
> criticise it too much im not an expert, I just do one off things to
help me
> make my life a little easier.) The advice was very helpfull. Thanks.
> Now I want to get it to actually run on the body of mail.
>
> How can I get this code to run on the body of a piece of mail?
> In other words open the mail message, click the macro and vola it
finds the
> first email address surounded by [ ]
>
> Thank you.
>
> Stacy
>
> Ps there is lots of msg boxes because I find they help in my debugging
> process.
>
> ----- code -----
> Sub aaTest_InStr4()
> 'March 15 2005
> 'Using the Instr Function this code looks for the brackets and will
give you
> 'the positions of the variables.
> 'However it only does it in the script it does not do it in a piece of
mail
>
> Dim SearchString1, SearchChar1, SearchChar2, MyPos1, _
> objDataObj As New DataObject
>
> SearchString1 = "[mailto:abc@domain.com]"
> SearchChar1 = "["
> SearchChar2 = "]"
> 'Position string is found in
> MyPos1 = InStr(1, SearchString1, SearchChar1, 1)
> MyPos2 = InStr(1, SearchString1, SearchChar2, 1)
>
> MsgBox "The [ bracket is found at position " & MyPos1 & "." & _
> " The ] bracket is found at position " & MyPos2 & "."
>
> FullEmailAddress = Mid(SearchString1, MyPos1, MyPos2)
>
> MsgBox "The full email address is " & FullEmailAddress
>
> JustEmailAddress = Mid(SearchString1, MyPos1 + 8, MyPos2 - 9)
>
> MsgBox "Just the email address is " & JustEmailAddress
>
> 'Put address in clipboard
> objDataObj.SetText JustEmailAddress
> objDataObj.PutInClipboard
> End Sub
>
> --- Code ---
>
>
>
> "Michael Bauer" <mib00@t-online.de> wrote in message
> news:ul2NIBTKFHA.2800@TK2MSFTNGP10.phx.gbl...
> > Hi Stacy,
> >
> > for searching strings in the message please use the Instr function.
It
> > returns the start position. This can be used to determining the
start
> > and end positions of a specific string. The string itself you can
then
> > get with the Mid$, Left$, or Right$ functions.
> >
> > Please just type in the function names and press F1 for samples.
> >
> > --
> > Viele Grüße
> > Michael Bauer
> >
> >
> > "Stacy" <stacy@123.com> wrote in message
> > news:uMBr5zNKFHA.4032@TK2MSFTNGP14.phx.gbl...
> > > Michael,
> > >
> > > Because the mail has been forwarded to me.
> > >
> > > That is, they have forwarded me the information but all of the
info in
> > the
> > > header of the mail is from the most recent sender not the one who
> > originally
> > > sent it.
> > >
> > > As I had mentioned the only info I get is what is in the email its
> > self. The
> > > header has no information on the original sender. So I want a
macro
> > which
> > > can extract info from the body of the message. I could cut the
mail
> > and
> > > paste it into word and then find it, because I can do this in
word.
> > But I
> > > don't know how to do it in Outllook 2000 mail message.
> > > Can you write a macro to search for [mailto:*******] in the body
of
> > the
> > > message? It seems to me that due to MS effort to stop virus's so
much
> > is not
> > > available in Outlook.
> > >
> > > Regards
> > > Stacy
> > >
> > > "Michael Bauer" <mib00@t-online.de> wrote in message
> > > news:etzHvDNKFHA.1176@TK2MSFTNGP12.phx.gbl...
> > > > Hi Stacy,
> > > >
> > > > why don´t you take the address from the SenderAddress property?
And
> > for
> > > > the reply, why not just call the MailItem.Reply method?
> > > >
> > > > --
> > > > Viele Grüße
> > > > Michael Bauer
> > > >
> > > >
> > > > "Stacy" <stacy@123.com> wrote in message
> > > > news:euv2tkKKFHA.2396@TK2MSFTNGP12.phx.gbl...
> > > > > People often forward me mail that I have to respond to.
Usually
> > its in
> > > > the
> > > > > following format.
> > > > > Note that the {end of line}is not in email Im just telling you
> > this
> > > > because
> > > > > it may make it easier to find the end of the line rather than
> > the ]
> > > > > -----snip---
> > > > > John can you follow up on this for me.
> > > > >
> > > > > Fred
> > > > >
> > > > > -----Original Message-----
> > > > >
> > > > > From: Joe Wu [mailto:jo_wu@hotmail.com] {end of line}
> > > > >
> > > > > Sent: Tuesday, March 08, 2005 12:41 PM
> > > > >
> > > > > To: Info Sales; Evals
> > > > >
> > > > > Subject: Eval Request - form
> > > > >
> > > > > -----snip--
> > > > >
> > > > > Can someone provide a macro that will search an open mail
message
> > for
> > > > the
> > > > > first email address in that mail and then copy it to
clipboard.
> > > > > Then I can paste it where I want. The first email message is
> > > > delineated by
> > > > > square brackets [ ]
> > > > >
> > > > > I can do this easily in a word macro if I paste the message
into
> > word.
> > > > It
> > > > > just searches for the first [ then selects from there to the
end
> > of
> > > > the line
> > > > > and copies it to clipboard.
> > > > >
> > > > > I suppose what would rally be nice is if it could take the
email
> > > > address
> > > > > from the body and then create a reply email based on the mail
it
> > got
> > > > the
> > > > > email address from but. That may be a little too involved.
> > > > >
> > > > > Regards
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
>
>
- Next message: Luc P Maes: "RE: COM AddIN Not loading"
- Previous message: Michael Bauer: "Re: Macro for using "Add Sender to Blocked Senders List" on multiple email messages simultaneously"
- In reply to: Stacy: "Re: Get address from body of message macro ?"
- Next in thread: Stacy: "Re: Get address from body of message macro ?"
- Reply: Stacy: "Re: Get address from body of message macro ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|