Updating Links
.Close savechanges:=False
has always worked for me to suppress any prompt about saving. Especially
after just doing a save. You can examine the Saved Property of the
workbook and see if it is true. If so, and it should be, you shouldn't get
a prompt.
You might skip the .Save and do
..Close SaveChanges:=True
so it is being saved in the same command as the close.
--
Regards,
Tom Ogilvy
"Jonathan Parminter" wrote in message
...
Hi, I have three layers of linked workbooks. The initial
data sheets are linked to group summary workbooks. These
group summary workbooks are then linked to a management
summary workbook.
The user problem is that the group summary workbooks must
be opened to update links, then saved, before the
management summary workbook is opened and updated.
The following code seems to work except the the user is
prompted to save changes before closing linked books. I
want this process to occur in the background without user
intervention. I had thought that application.displayalerts
and having the method save would avoid this...
*** code start ***
aLinks = xlMainBook.LinkSources(xlExcelLinks)
Application.ScreenUpdating = False
If Not IsEmpty(aLinks) Then
For intIndex = 1 To UBound(aLinks)
Application.DisplayAlerts = False
strBook = aLinks(intIndex)
Set xlBook = Workbooks.Open(Filename:=strBook,
UpdateLinks:=True)
With xlBook
.SaveLinkValues = True
.Save
.Close savechanges:=False
End With
Next intIndex
End If
***code ends ***
Any suggestions or ideas appreciated :-)
Thanks
Jonathan
|