email body without "HYPERLINK" ( vba )

Status
Not open for further replies.

skrz

Member
Outlook version
Email Account
Exchange Server
Hi,

a sample email :

Hello,

I'm sending to you ....

www.google.com

then we select in Outlook and run vba code :

SelectMail = Outlook.ActiveExplorer.Selection.Item(1)

strEmail = SelectMail.body

If we display strEmail ( msgbox )

then we get :



Hello,

I'm sending to you ....

HYPERLINK"
http://google.com"www.google.com

how to get rid of expression HYPERLINKhttp://google.com

I need only text message as string ( the same as we select email contents and copy - paste to notepad )

Thanks



 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: email body without "HYPERLINK" ( vba )

Actually, if its in the Msgbox only, not in the message, Alt+F9 won't help. (But I've never seen hyperlink code in a msgbox...) HTMLbody *should* work to get the rendered text, not the underlying code.
 

skrz

Member
Outlook version
Email Account
Exchange Server
Hello Diane,

to clarify my case ( please see attached document )

regards

Michal
 

Attachments

  • forum explanation.pdf
    84.1 KB · Views: 396

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
That looks like the hyperlink field code. I've not seen it picked up and used in a msgbox though, that seems odd - my tests all use the google.com<http://www.google.com> format for urls - still not what you want (I assume)...

Try this - you'll need to reference MSForms - in VBA Editor, go to Tools, References and add a check to the MSForms entry.

Sub testskrz()

Dim selectmail As MailItem

Dim DataObj As MSForms.DataObject
Set selectmail = ActiveExplorer.Selection.Item(1)
Set DataObj = New MSForms.DataObject
DataObj.SetText selectmail.Body
DataObj.PutInClipboard
DataObj.GetFromClipboard

MsgBox DataObj.GetText(1)

End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It's still coming up with the word hyperlink? Is this an RTF formatted message? Try RTFBody.






The macro I posted gets me this on an HTML message:




macro-results.jpg
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
T Is it possible to save email body without header? Outlook VBA and Custom Forms 6
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 3
Z Copy specific email body text Outlook VBA and Custom Forms 0
J How do you disable address search box when typing @ in body of email? Using Outlook 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
Z Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
C Transfer Outlook TextBox Text Into Email Body Outlook VBA and Custom Forms 2
A Forwarding email and replacing body Outlook VBA and Custom Forms 1
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
M Want to autorespond to an email address in the body of message Using Outlook 0
K Extract email address from body and auto-reply outlook Using Outlook 1
D VBA to edit body of incoming email and forwarding it Outlook VBA and Custom Forms 11
O VBA to extract email (fields and body) to Excel Outlook VBA and Custom Forms 14
A Create Macro for hyperlink(email) in message body Outlook VBA and Custom Forms 9
L Copy email body fields to excel Using Outlook 0
J Pull an email address from body and replace reply-to address Outlook VBA and Custom Forms 4
divan Outlook 2007 - Replace email body with custom text Using Outlook 9
E Button in body of email to approve/reject with original text Using Outlook 1
B Extract Dates for Appointment Item in Body of email Outlook VBA and Custom Forms 10
M Sending Excel Charts in the Body of an Email Using Outlook 1
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
E Automatically pick up Recipient's Name on the Body of the Email Message Using Outlook 1
A Create Task from Email and put body & email as attachment into task notes Outlook VBA and Custom Forms 17
Aussie Looking for Outlook macro to Copy Recipient Names into Email Body Outlook VBA and Custom Forms 3
A Macro to copy email body to new email Outlook VBA and Custom Forms 5
R Body of email not visible in Outlook Data File Sent Folder Using Outlook 4
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
G Create rule based on image in email body Using Outlook 1
F Script needed for replying to email address in body of receiving email Using Outlook 46
I can't view email body please help! Using Outlook 6
D Email addresss in body of email with single quote Using Outlook 3
M rule to change subject, pull email addresses from body, and forward with templ Using Outlook 14
L Script to: Change subject of email after checking body Using Outlook 2
H Extract emails from Outlokk 2007 email body Using Outlook 0
L Forward Email and Insert Sender's Email address in body Outlook VBA and Custom Forms 3
S HELP: Email body transcript deleted when receiving response emails Outlook VBA and Custom Forms 1
T Can not change email body content on Outlook 2010 Outlook VBA and Custom Forms 2

Similar threads

Top