Link to home
Start Free TrialLog in
Avatar of csehz
csehzFlag for Hungary

asked on

VBA Word 2000 - Create hyperlink

Dear Experts,

I do not have any experience applying VBA in Word, could you please advise how to do with VBA converting texts to hyperlink?

Basically I have a file on path D:\ASN\Test.xls, for this I would like to create hyperlink like it is done manually in the attached Word file.

My final target anyway to assign this file name to a variable like FileName = "D:\ASN\Test.xls", and based on that create hyperlink.

In my daily work have several such paths which needs to be sent for people in mail, so would like if the word could generate them.

thanks,
CreateHyperlink.doc
Avatar of csehz
csehz
Flag of Hungary image

ASKER

In the meantime I have working macro in Excel for such target in the attached Code,

Do you think that is it possible to do this in Word? The only difference would be just that the hyperlink should be for example in the next row instead of cell A1


Sub CreateHyperlinks2()
Dim FileLink As String
    
FileLink = "D:\ASN\Test.xls"

Worksheets("Sheet1").Range("A1").Formula = "=HYPERLINK(""" & FileLink & """,""" & FileLink & """)"
Worksheets("Sheet1").Range("A1").Font.Color = 16711680

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jmdion
jmdion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of csehz

ASKER

That is perfect :-) Thanks