add hyperlink to word's bookmark from excel vba

drom

Active Member
Joined
Mar 20, 2005
Messages
498
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
  6. 2007
Hi and thanks in advance

I have a word file.
I have to populate whithin this word file a few lines, a few websites and a few phone numbers.

I know How to write data whithin word's bookmaks as follows:
Code:
Dim WordDoc As Object:                Set WordDoc = WordApp.Documents.Open(wFxFN)
WordDoc.FormFields(wMarcador).Result = wCell

but when the data I want to enter is a webSite:

Code:
          XX = 0:                     XX = InStr(LCase(wCell), "ttp://www")
          If XX = 0 Then
            WordDoc.FormFields(wMarc).Result = wCell
          Else
             ZZ=ZZ+1
            'WordDoc.FormFields(wMarcador).Result = "LINK_" & Format(ZZ, "00")
            'How can I add a hyperlink, say eg: www.mrexcel.com"
            With WordDoc.FormFields(wMarc)
                '.Result = "LINK_" & Format(ZZ, "00")   ????
                '.Text = "LINK_" & Format(ZZ, "00")     ????
                .Hyperlinks.Add Anchor:=.Words(1), Address:="www.mrexcel.Com" ????
            End With


What do I have to do??

say I want to enter whithin:

WordDoc.FormFields("wMarc") the website "www.mrExcel.com" and see Link01, and keep the bookmark, for the next time
Thanks!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,203,240
Messages
6,054,315
Members
444,716
Latest member
choumnan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top