ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to refresh an Excel workbook from VBA (https://www.excelbanter.com/excel-programming/434636-how-refresh-excel-workbook-vba.html)

RSunday

How to refresh an Excel workbook from VBA
 
I want to run a number of scenarios through a business model in Excel.

I have all my input values in an Access table and can load them into the
relevant cells of my Excel sheet through Access-VBA.

I can also pick the resulting values from my Excel sheet.

Only thing I need to do is to refresh the calculations as a result of my new
input.

How is that done from VBA?

I link to my Excel through this code:

Dim xlBook As Object
Set xlBook = xlApp.Workbooks.Open(path & "\" & filename, 0, True)

and then I can access cell values.

Patrick Molloy[_2_]

How to refresh an Excel workbook from VBA
 
you can just add

Calculate

for the whole workbook, or
[Object.]Calculate

where the object can be worksheet or range

"RSunday" wrote:

I want to run a number of scenarios through a business model in Excel.

I have all my input values in an Access table and can load them into the
relevant cells of my Excel sheet through Access-VBA.

I can also pick the resulting values from my Excel sheet.

Only thing I need to do is to refresh the calculations as a result of my new
input.

How is that done from VBA?

I link to my Excel through this code:

Dim xlBook As Object
Set xlBook = xlApp.Workbooks.Open(path & "\" & filename, 0, True)

and then I can access cell values.


Patrick Molloy[_2_]

How to refresh an Excel workbook from VBA
 
xlapp.Calculate

"RSunday" wrote:

I want to run a number of scenarios through a business model in Excel.

I have all my input values in an Access table and can load them into the
relevant cells of my Excel sheet through Access-VBA.

I can also pick the resulting values from my Excel sheet.

Only thing I need to do is to refresh the calculations as a result of my new
input.

How is that done from VBA?

I link to my Excel through this code:

Dim xlBook As Object
Set xlBook = xlApp.Workbooks.Open(path & "\" & filename, 0, True)

and then I can access cell values.



All times are GMT +1. The time now is 10:33 AM.

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