getting the subject of currently open mail into another program

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hi,
I'm not a very accomplished programmer. I'm trying to
write a very simple script-like routine to automate a
cumbersome and repetitive task.

I periodically get Emails that contain a specific number
inteh subject line (in this case a purchase requisition
number).

I then have to open another program entirely (SAP) and go
through a log in procedure and subsequently manually re-
enter the requisition number to SAP (or at least do a cut-
paste).

It's pretty trivial to scrip the steps to do the Open SAP,
log in, enter requisition number.

How does one get the "subject" information from an open
email message?

something like:

oSubject = CurrentlySelectedMail.Subject

I know that's not right, but there must be an object that
can give me this info.

Any ideas?

Thanks in advance.

-George
 
Instead of CurrentlySelectedMail, use
Application.ActiveInspector.CurrentItem.
 
Thanks Sue.

So (please forgive my ignorance here), something like the
following should let me get the subject and diplay it in a
mesage box?:

Sub Getsubject()
Dim osubj As String
osubj = Application.ActiveInspector.CurrentItem.Subject
MsgBox (osubj)
End Sub

???

That doesn't work, but something along those lines?

Thanks again.
 
ignore my last plea. Thanks to your first tip, and a
little RTFM, I found this example:

Set myOlApp = CreateObject("Outlook.Application")
Set myInspector = myOlApp.ActiveInspector
MsgBox "The active item is " &
myInspector.CurrentItem.Subject

this gives me the info I need to proceed.

Thanks again.
 
Back
Top