Error gathering subject for mail envelope

Hi

I am trying to gather the Subject of the current email in the mail envelope and I am getting an error for
sSubject = Application.ActiveSheet.MailEnvelope.Item.To
sSubject = Application.ActiveSheet.MailEnvelope.To
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteveCost AccountantCommented:
Shouldn't it be .Subject not .To:

sSubject = ActiveSheet.MailEnvelope.Item.Subject

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. When I use that code I get a blank string or "". The image shows that I have something in the subject of my mail
1
SteveCost AccountantCommented:
Have you tried ConversationTopic ?

sSubject = ActiveSheet.MailEnvelope.Item.ConversationTopic

Open in new window


This may be the 'subject' if subject = ""
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi
Thanks. That also returned a blank
SteveCost AccountantCommented:
OK.. it may be that it uses the filename:

sSubject = ActiveSheet.MailEnvelope.Parent.Name

Open in new window


In my tests it is always the filename.
But the second I put a watch on it , the subject fills in!
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. I am not sure how to use the filename
SteveCost AccountantCommented:
Use Parent.name this should be the file name:

sSubject = ActiveSheet.MailEnvelope.Parent.Name

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi

Thanks but how do I get the Subject. This only gives me the file name
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
ActiveSheet.MailEnvelope.Item.Subject   is correct.

After changing something in the displayed form, you need to access data like the subject, wait some milliseconds, and then read again. At least that helped when I tried it out just that moment.
Seems to be an issue with the automation interface not properly updating internal data.
SteveCost AccountantCommented:
So maybe change the .bcc property as it is likely empty... then you should be able to read the Subject.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
I tried that but couldn't get it to work
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.