Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default links are not updated

I have Sheet1 linked to Sheet2. The Sheet2 is linked to the Sheet3.
I want to update values in the Sheet1 linked to the Sheet2 assuming if any
changes are done in the Sheet3 it'll be reflected in the Sheet1.

So, I'm changing the values in the Sheet3 and closing it. After that, having
Sheet1 opened I'm openning the Sheet2 and everything is fine the values in
the Sheet1 have been updated.

But, when I'm clicking a button on the Sheet1 and using the code below it's
not working - the values in the Sheet1 are not updated when I'm doing changes
in the Sheet3 and closing it and after that openning the Sheet2 through the
code below with supposed to be links updated.

Can anybody help me with it.

Sub Update_Links()
On Error GoTo Update_Links_Err
Dim xlapp As Object
Dim xlbook As Object
Dim strFileName As String
Dim logFlag As Boolean

logFlag = False

strFileName = "Sheet2.xls"

Set xlapp = CreateObject("Excel.Application")

xlapp.DisplayAlerts = False
xlapp.AskToUpdateLinks = False

Set xlbook = xlapp.Workbooks.Open(strFileName, UpdateLinks:=1)
logFlag = True

xlapp.AskToUpdateLinks = True
xlapp.DisplayAlerts = True

xlbook.Close savechanges:=True
xlapp.Quit

Set xlbook = Nothing
Set xlapp = Nothing

Update_Links_exit:

Exit Sub
Update_Links_Err:
xlapp.DisplayAlerts = True
xlapp.AskToUpdateLinks = True
If logFlag Then
xlbook.Close savechanges:=False
xlapp.Quit

Set xlbook = Nothing
Set xlapp = Nothing

End If
MsgBox Err.Description
Resume Update_Links_exit
End Sub




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP - the file links cannot be updated! Eric Excel Discussion (Misc queries) 0 March 9th 08 01:37 AM
links that cannot be updated Dan Excel Discussion (Misc queries) 2 January 19th 08 06:46 PM
Links Cannot Be Updated slreilly Excel Discussion (Misc queries) 0 February 21st 07 05:57 PM
Links not showing updated value Wanson Excel Discussion (Misc queries) 2 December 8th 05 02:50 PM
Links cannot be updated ebferro Excel Programming 1 October 31st 04 04:06 PM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"