> I have tried various sequences of the Activate function and the UpdateLinks
> parameter. Changing from a UNC file address to G:\ seemed to fix yesterday's
> problem.
I don't think Activate will do anything for you.
If calculation mode is automatic then, if the links are correctly formed, the
updates should all occur on opening the master workbook.
Might be worth including
Application.Calculate
in the procedure just to be sure of the first.
So we are left with the links being badly formed, in the sense that Excel does
not realise that they are addressing the other workbook.
You are probably on the right track with UNC vs drivename filenames.
Links to files in the same directory are effectively held as relative links (ie
they should work regardless of the path used to access that directory).
However, if one workbook thinks it came from \\Server\dir and the other thinks
it came from G:\dir they may not be able to tell that the directories are the
same and thereby make the links between the two open workbooks.
I would suggest changing the Open line to
Workbooks.Open Filename:= _
ThisWorkbook.Path & "\Master.xls", UpdateLinks:=3
which will ensure that both workbooks think they were loaded from the same
directory.
If the links in one or other file are to the wrong form of directory they may
need to be updated. For example, in the data entry workbook (which only has one
link source?).. something like this (untested):
Dim V
V = ThisWorkbook.LinkSources(xlExcelLinks)
If LCase(V(LBound(V)))<>LCase(ThisWorkbook.Path & "\Master.xls") Then
ThisWorkbook.ChangeLink V(LBound(V)), ThisWorkbook.Path & "\Master.xls"
End If
For the links in the master it is a bit more complicated because there are
multiple sources.
Dim I As Integer
V = Workbooks("Master.xls").LinkSources(xlExcelLinks)
For I=LBound(V) To UBound(V)
If LCase(Right(V(I),Len(ThisWorkbook.Name)+1))="\" &
LCase(ThisWorkbook.Name) Then
Workbooks("Master.xls").ChangeLink V(I), ThisWorkbook.FullName
End If
Next
Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup
Andrew S - 10 Nov 2004 03:17 GMT
Thanks Bill,
the "ThisWorkbook.Path & "\Master.xls", " did the trick.
Andrew
> > I have tried various sequences of the Activate function and the UpdateLinks
> > parameter. Changing from a UNC file address to G:\ seemed to fix yesterday's
[quoted text clipped - 48 lines]
> MVP - Microsoft Excel, Oxford, England
> No email replies please - respond to newsgroup