ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Macro, how can I check if an opened workbook was changed ? (https://www.excelbanter.com/excel-programming/370408-using-macro-how-can-i-check-if-opened-workbook-changed.html)

Macro to check if a workbook has changed

Using Macro, how can I check if an opened workbook was changed ?
 
please help. I have in a VBA project a Workbook that opens 13 other
workbooks, and at end must close them all. At the moment my instructions to
the Main workbook is to save them all, and this is costing a lot of time when
I am waiting for the files to be saved. now I want to change to a situation
where the workbook closes the files that were not changed, and only save the
one that has been changed.

Jim May

Using Macro, how can I check if an opened workbook was changed ?
 
Dim wkbk As Workbook
On Error Resume Next
For Each wkbk In Workbooks
wkbk.Save
wkbk.Close
Next

"Macro to check if a workbook has changed" wrote:

please help. I have in a VBA project a Workbook that opens 13 other
workbooks, and at end must close them all. At the moment my instructions to
the Main workbook is to save them all, and this is costing a lot of time when
I am waiting for the files to be saved. now I want to change to a situation
where the workbook closes the files that were not changed, and only save the
one that has been changed.


Bob Phillips

Using Macro, how can I check if an opened workbook was changed ?
 
Dim oWB As Workbook
On Error Resume Next
For Each oWB In Application.Workbooks
If Not oWB.Saved Then oWB.Save
oWB.Close
Next


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Macro to check if a workbook has changed" <Macro to check if a workbook has
wrote in message
...
please help. I have in a VBA project a Workbook that opens 13 other
workbooks, and at end must close them all. At the moment my instructions

to
the Main workbook is to save them all, and this is costing a lot of time

when
I am waiting for the files to be saved. now I want to change to a

situation
where the workbook closes the files that were not changed, and only save

the
one that has been changed.





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

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