Ben
Ben

Reputation: 1

Get selected text from subject line

I have searched and found this answer but it won't seem to work for me. I need to get the selected (highlighted) text from the subject of the email. When I try the linked solution from either the preview pane or from an open email, I only get the first character of the body. I attempted to look at all properties of mail.GetInspector.WordEditor but nothing seems to contain the selected text. As stated, mail.GetInspector.WordEditor.Application.Selection only has the first character of the body. In my code, I have mail as type MailItem and is set to ActiveExplorer.Selection.Item(1).

My code works fine when the selected text is in the body of the email.

Upvotes: 0

Views: 514

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66296

You need to find the Windows control containing the subject and send WM_GETTEXT message to it.

I don't think you can do that in VBA.

Upvotes: 0

Related Questions