ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating spreadsheet links from VBA (https://www.excelbanter.com/excel-programming/416461-updating-spreadsheet-links-vba.html)

amorphous999

Updating spreadsheet links from VBA
 
I'm not sure if this is a Excel question or an Access question.

I have a spreadsheet (call it "A") that links to data from several
different spreadsheets. I have an Access database links to worksheets in
"A", and some queries run from VBA that use linked tables.

So when I run the VBA, it runs queries that refer to the linked tables,
which in turn refers to the spreadsheet "A" which has links to other
spreadsheets.

The problem is getting the spreadsheet "A" to update its links to the other
spreadsheets. Currently, I manually open the spreadsheet, it prompts me if
I want to update the links, I answer "Yes", the links get updated, and then
I close "A" and run the macro.

What I would like to do is from Access VBA, open "A", cause all the links
to be updated and then close the spreadsheet. How do I do that?

amorphous

joel

Updating spreadsheet links from VBA
 
Sub OPenExcel()

Set obj = GetObject("C:\temp\book1.xls")
obj.Application.Visible = True

obj.Close
End Su

"amorphous999" wrote:

I'm not sure if this is a Excel question or an Access question.

I have a spreadsheet (call it "A") that links to data from several
different spreadsheets. I have an Access database links to worksheets in
"A", and some queries run from VBA that use linked tables.

So when I run the VBA, it runs queries that refer to the linked tables,
which in turn refers to the spreadsheet "A" which has links to other
spreadsheets.

The problem is getting the spreadsheet "A" to update its links to the other
spreadsheets. Currently, I manually open the spreadsheet, it prompts me if
I want to update the links, I answer "Yes", the links get updated, and then
I close "A" and run the macro.

What I would like to do is from Access VBA, open "A", cause all the links
to be updated and then close the spreadsheet. How do I do that?

amorphous



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

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