I'm creating a document using an existing document and adding text to it, then saving it as a different filename. I'd like to have a hyperlink in it, but I'm having an issue. The hyperlink is created and looks fine but doesn't work because the file location is added to the begining of it.

objDocument = objWordApp.Documents.Open("C:\shippingmanifest4.docx")

Dim myRg As Word.Range = oTable.Cell(intRow, 2).Range
Dim addr As String = "www.fedex.com/fedextrack/index.html?tracknumbers=" & strTID
objDocument.Hyperlinks.Add(myRg, addr, "", "", strTID, "")

The link actually ends up being "C:\www.fedex.com\fedextrack\index.html?tracknumbers=1Zfedextrackingid"

Recommended Answers

All 4 Replies

Such a simple solution. Thanks so much.

if your question is resolved then please mark the post as solved

If you don't specify http:// at the start word assumes it is a filepath link...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.