Links in excell

K

kurt

Hi

I have to open workbooks and have created a link between theese.
If I do it by VBA the system are using the UNC adress.
If I do it by Excel the system are using the logical.
But if I am doing it by VBA, Excell dont recognize this.
I think it is something by rights and that I cant do anything about.
Anyone know a how to work around this problem.

regards
Kurt
 
G

Gareth

I'm not sure what you mean by <But if I am doing it by VBA, Excell dont
recognize this.> but I'll try and help anyway.

I have noticed in the past however that Excel does tend to change UNC
paths to real paths whenever it can - it's been a constant source of
annoyance.

You could try changing the links back to UNC paths everytime the
workbook is saved. Place something like the below in the ThisWorkbook
module:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim linksrc As Variant

For Each linksrc In Me.LinkSources(xlExcelLinks)
Me.ChangeLink linksrc, GetUNCPath(linksrc), xlExcelLinks
Next linksrc
End Sub

This assumes you have a function called GetUNCPath available that
returns the UNC path for any passed path. If you don't have something
that does this then please see the below link:
http://groups-beta.google.com/group...&q=GetStrFromPtrA&hl=en&#doc_62fe68c412b24763

HTH,
Gareth
 
K

kurt

I have found the source to my problem.
th problem is the function "hyperlinks" this I use to jump from
workbook to workbook and this function are using the UNC adress; and
this is changing the logical adress in the links.

thanks for your help

regards

Kurt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top