ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Links in excell (https://www.excelbanter.com/excel-programming/335617-links-excell.html)

kurt

Links in excell
 
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


Gareth[_6_]

Links in excell
 
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/...fe68c412b24763

HTH,
Gareth



kurt wrote:
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


kurt

Links in excell
 
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



All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com