ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vba Excel - Checking if changes were made (https://www.excelbanter.com/excel-programming/335619-vba-excel-checking-if-changes-were-made.html)

ajliaks[_45_]

Vba Excel - Checking if changes were made
 

Hi friends,
i hope somebody knows the right answer to this questions:

1.- Before closing the workbook, I need to know (programatically) if
any changes were made to it, something like..
Sub BeforeClosing()
If myWrkBk.ChangesWereMade = True then
'XXX
End if
End Sub

2.- My workbook (with the macro) is on the local server, and uses
several other worbooks too. when I try to open one of those several
workbooks it may be already open. Is there anyway i could know if that
workbook is already running in some place in the server?

Thanks in advance,
Aldo.


--
ajliaks
------------------------------------------------------------------------
ajliaks's Profile: http://www.excelforum.com/member.php...fo&userid=8196
View this thread: http://www.excelforum.com/showthread...hreadid=390474


Dave Peterson

Vba Excel - Checking if changes were made
 
#1. You can check to see if excel thinks the workbook is "dirty" (needs
saving).
if mywkrbk.saved = true then
'no outstanding changes
else
'something could have changed since the last save
end if

#2. Take a look at this kb article:
http://support.microsoft.com?kbid=138621

If you don't need to make changes and save that other workbook, maybe you
could just open it readonly.

ajliaks wrote:

Hi friends,
i hope somebody knows the right answer to this questions:

1.- Before closing the workbook, I need to know (programatically) if
any changes were made to it, something like..
Sub BeforeClosing()
If myWrkBk.ChangesWereMade = True then
'XXX
End if
End Sub

2.- My workbook (with the macro) is on the local server, and uses
several other worbooks too. when I try to open one of those several
workbooks it may be already open. Is there anyway i could know if that
workbook is already running in some place in the server?

Thanks in advance,
Aldo.

--
ajliaks
------------------------------------------------------------------------
ajliaks's Profile: http://www.excelforum.com/member.php...fo&userid=8196
View this thread: http://www.excelforum.com/showthread...hreadid=390474


--

Dave Peterson


All times are GMT +1. The time now is 10:46 PM.

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