Thread: On error...
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default On error...

In that instance, try just wrapping it with error statements as I showed

On Error Resume Next
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources
On Error Goto 0

This should mitigate against any further problems,. The other option is to
test whether the file is open, if so, don't issue the update.
--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"ph8" wrote in message
...

I can understand how ignoring errors is probably not the best habit to
form when coding. So I guess maybe if there was a way to avoid the
error altogether that would be the best bet.

I get the error when both the source and destinatino spreadsheets are
open on the same computer and I try to update the links with that
particular line of VBA code which updates the link (
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources). The error
I get is "-Method 'UpdateLink' of object '_Workbook' failed-."

That code is on the destination spreadsheet. WHere formula links exist
in the cells. But when I have both this destination spreadsheet and
source spreadsheet open (on the same computer). When the source file
is opened on a different computer (ala network) or when its closed the
function performs flawlessly.


--
ph8
------------------------------------------------------------------------
ph8's Profile:

http://www.excelforum.com/member.php...o&userid=19871
View this thread: http://www.excelforum.com/showthread...hreadid=517217