ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   updating links with calculations in many workbooks (https://www.excelbanter.com/excel-programming/314822-updating-links-calculations-many-workbooks.html)

ALEX

updating links with calculations in many workbooks
 
I have two major workbooks with calculated cells linked to many other
workbooks. Those other workbookes have calculated linked cells to these two
major workbooks.

I'm opening these two major workbooks in a system (everything is hidden for
a user):
xlapp1.AskToUpdateLinks = False ' to update links
Set xlbook1 = xlapp1.Workbooks.Open(strOurFileName, True)

With xlbook1 ' updating links again, just in case

.UpdateLink Name:=.LinkSources ' ActiveWorkbook.LinkSources '

End With

' Checking for any error:
If IsError(.Worksheets(1).Cells(i, j)) = True Then
....

The same for the other workbook.
....
Keeping them opened.

Then, I'm opening with links updating in the same way those many workbooks.
But, after opening I'm closing them.

After all linked workbookes have been opened and closed, I' updating links
again in the two major workbooks:

With xlbook1

.UpdateLink Name:=.LinkSources ' ActiveWorkbook.LinkSources '

End With

and close them:
xlapp1.ActiveWorkbook.Save
xlapp1.Quit

After that, I transfer the data from the one of the two workbooks into DB
table, but data there are not updated.

However, when I open the workbook in a regular way (without programing), I
can see that data is been updated in this workbook.

May be I should at the end in my code close the major workbook, open it
again, and close it again?

Could anybody advise anything?

Thanks





All times are GMT +1. The time now is 05:37 PM.

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