SeanDamnit
Board Regular
- Joined
- Mar 13, 2011
- Messages
- 151
Hey Kids,
Apologies if this is more Outlook related than Excel, but this forum has been my best resource for VBA help.
What I'd like to do is run a macro every time certain e-mails come in that would extract some text and a table in to an excel document. Opening the excel document and adding specific parts of the body text is fairly straight forward, but getting the table is difficult. After some searches, this is the only method I found that works:
The problem with this is that it needs to be in an Inspector window (mail item needs to be open) to work. I can't just be selecting the mail item and run the macro, and more importantly, I can't setup a Rule in outlook to run this script whenever an e-mail with a specific subject line is received.
One option is to have the script open the mail item, extract the info, then close it. But that may get disruptive if the user is working on other things throughout the day and mail items are randomly being opened and closed.
Any suggestions?
Thanks!
Apologies if this is more Outlook related than Excel, but this forum has been my best resource for VBA help.
What I'd like to do is run a macro every time certain e-mails come in that would extract some text and a table in to an excel document. Opening the excel document and adding specific parts of the body text is fairly straight forward, but getting the table is difficult. After some searches, this is the only method I found that works:
Code:
Sub Extract() Dim doc As Object
Dim tbl As Object
Set doc = ActiveInspector.WordEditor
Set tbl = doc.Tables(1)
'From here I can use tbl.Range.Copy to move the data in to an excel sheet
End Sub
The problem with this is that it needs to be in an Inspector window (mail item needs to be open) to work. I can't just be selecting the mail item and run the macro, and more importantly, I can't setup a Rule in outlook to run this script whenever an e-mail with a specific subject line is received.
One option is to have the script open the mail item, extract the info, then close it. But that may get disruptive if the user is working on other things throughout the day and mail items are randomly being opened and closed.
Any suggestions?
Thanks!