ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine whether a wrkbook have been changed since the last save (https://www.excelbanter.com/excel-programming/350133-determine-whether-wrkbook-have-been-changed-since-last-save.html)

Henk Frigge[_2_]

Determine whether a wrkbook have been changed since the last save
 
I have splitted a very large and complex workbook in three seperate parts. To
navigate between the different workbooks I created a new workbook with four
buttons "Open file A", "Open file B", "Open file C" and "Exit" So far I
managed to ask the user if he wants to save the file he is leaving before
opening the other. E.g. User opens File A, makes some changes and selects
File B for opening. A little form asks him if he wants to save the changes he
made to File A. According to his answer File A is saved or not, and File B is
opened. So far so good. But now I want the little Save-Yes/No form only to
appear if he made changes to the File A. How do I determine whether he made
changes to the file or not?

Thanks in advance,

Henk




Jim Thomlinson[_5_]

Determine whether a wrkbook have been changed since the last save
 
Without seeing any code it is hard to give you any specific code. There is a
saved property with a workbook which is set to false when a change is made.

Sub test()
Dim wbkA As Workbook

Set wbkA = Workbooks("File A.xls")
MsgBox wbkA.Saved
End Sub
--
HTH...

Jim Thomlinson


"Henk Frigge" wrote:

I have splitted a very large and complex workbook in three seperate parts. To
navigate between the different workbooks I created a new workbook with four
buttons "Open file A", "Open file B", "Open file C" and "Exit" So far I
managed to ask the user if he wants to save the file he is leaving before
opening the other. E.g. User opens File A, makes some changes and selects
File B for opening. A little form asks him if he wants to save the changes he
made to File A. According to his answer File A is saved or not, and File B is
opened. So far so good. But now I want the little Save-Yes/No form only to
appear if he made changes to the File A. How do I determine whether he made
changes to the file or not?

Thanks in advance,

Henk




Henk Frigge[_2_]

Determine whether a wrkbook have been changed since the last s
 
Jim,

Thanks for your prompt answer.

Your code indeed generates the information I am looking for. I would like to
create something like this :

Dim bk2 As Workbook
Set bk2 = Workbooks("Wniq Zyprexa forecast B.xls")

If bk.Save = True Then
Workbooks("Wniq Zyprexa forecast B.xls").Close SaveChanges:=False
Else
Switch_Module_1.Show
End If

This code results in a compile error : Expected function or variable.

Thanks,

Henk Frigge



"Jim Thomlinson" wrote:

Without seeing any code it is hard to give you any specific code. There is a
saved property with a workbook which is set to false when a change is made.

Sub test()
Dim wbkA As Workbook

Set wbkA = Workbooks("File A.xls")
MsgBox wbkA.Saved
End Sub
--
HTH...

Jim Thomlinson


"Henk Frigge" wrote:

I have splitted a very large and complex workbook in three seperate parts. To
navigate between the different workbooks I created a new workbook with four
buttons "Open file A", "Open file B", "Open file C" and "Exit" So far I
managed to ask the user if he wants to save the file he is leaving before
opening the other. E.g. User opens File A, makes some changes and selects
File B for opening. A little form asks him if he wants to save the changes he
made to File A. According to his answer File A is saved or not, and File B is
opened. So far so good. But now I want the little Save-Yes/No form only to
appear if he made changes to the File A. How do I determine whether he made
changes to the file or not?

Thanks in advance,

Henk





All times are GMT +1. The time now is 04:38 PM.

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