Solved

Word XP Hyperlinks to Network docs - Need to capture the UNC

Posted on 2004-09-09
4
294 Views
Last Modified: 2010-04-17
I am programmatically adding Hyperlinks in a Word XP document. The Hyperlinks point to other Word documents that are stored on various Network shares. I need to capture the full Network UNC paths for the hyperlink, as opposed to the mapped drive that the user is using to point to that document, so that when the document is distributed, all the other users can click on the hyperlink and open the document.

I have no problem inserting the hyperlinks programattically. I have code that opens the FileDialog box and allows the user to select the name of the file, and the filename and full path (of the mapped drive on the user's machine) is stored in a textbox on a UserForm. I then have the Hyperlinks created in the Word document from the textboxes on the UserForm. What I need to do is capture the UNC path somehow, and I can't seem to find any property or method that allows me to do that.

Here is the code that creates the hyperlink, which works fine:

        ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:= _
        strText1, SubAddress:="", ScreenTip:="", TextToDisplay:= strText1

Thanks for your help!
       
0
Comment
Question by:SWisowaty
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
cookre earned 500 total points
ID: 12017884
0
 
LVL 22

Expert Comment

by:cookre
ID: 12017915
In .NET, just use WNetGetUniversalName()
0
 
LVL 22

Expert Comment

by:cookre
ID: 12017930
0
 

Author Comment

by:SWisowaty
ID: 12042873
Thanks, cookre - just what I needed!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now