bleepit
08-10-2018, 08:52 AM
A coworker wanted me to show her the other day how to quickly add a link to the FedEx website for tracking numbers she has to send through e-mail. I showed her how using the Ctrl+K method but got the idea afterward that a macro would be far better and much faster.
The idea is just for her to be able to copy and paste a tracking number into an e-mail. Highlight the tracking number, run the macro, and it would convert the tracking number into a hyperlink to the FedEx tracking website to track the highlighted tracking number.
For example:
Tracking number: 0123456789
Would become:
https://www.fedex.com/apps/fedextrack/?tracknumbers=0123456789
If I could get it to become: 0123456789 (https://www.fedex.com/apps/fedextrack/?tracknumbers=0123456789) This would be even better.
I’m still pretty new to VBA coding, but this is what I have and I can’t get it to work. I’m sure I’m missing something stupid and obvious. I was wondering if someone could take a look for me and spot what I’m doing wrong.
We are using Office 2010
Sub SelectLink()
Selection.InsertBefore Text:="https://www.fedex.com/apps/fedextrack/?tracknumbers="
Selection.InsertAfter Text:=" "
Selection.Collapse wdCollapseEnd
End Sub
Thanks so much in advance
The idea is just for her to be able to copy and paste a tracking number into an e-mail. Highlight the tracking number, run the macro, and it would convert the tracking number into a hyperlink to the FedEx tracking website to track the highlighted tracking number.
For example:
Tracking number: 0123456789
Would become:
https://www.fedex.com/apps/fedextrack/?tracknumbers=0123456789
If I could get it to become: 0123456789 (https://www.fedex.com/apps/fedextrack/?tracknumbers=0123456789) This would be even better.
I’m still pretty new to VBA coding, but this is what I have and I can’t get it to work. I’m sure I’m missing something stupid and obvious. I was wondering if someone could take a look for me and spot what I’m doing wrong.
We are using Office 2010
Sub SelectLink()
Selection.InsertBefore Text:="https://www.fedex.com/apps/fedextrack/?tracknumbers="
Selection.InsertAfter Text:=" "
Selection.Collapse wdCollapseEnd
End Sub
Thanks so much in advance