Link to home
Start Free TrialLog in
Avatar of SWisowaty
SWisowaty

asked on

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

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!
       
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

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
In .NET, just use WNetGetUniversalName()
Avatar of SWisowaty
SWisowaty

ASKER

Thanks, cookre - just what I needed!