ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Timestamp Saved (https://www.excelbanter.com/excel-programming/373599-timestamp-saved.html)

jk

Timestamp Saved
 
I have the following code:

Private Sub Workbook_Open()
Worksheets(1).Range("A1").Value = Now()
End Sub

This shows current date and time but i only need it to change if workbook is
modified. This code will be within a workbook that is sent from one country
to another and needs to maintain its orginal timestamp.Can this be done?


Dave Peterson

Timestamp Saved
 
But if the user chooses to close without saving, then the change in the
workbook_open event will be lost.

If the user chooses to save, then your change is kept.

If you don't want your change to mark the workbook as "dirty" (changed without
being saved), you could use:

Private Sub Workbook_Open()
me.Worksheets(1).Range("A1").Value = Now
me.saved = true
End Sub

Then the user won't be prompted to save because of this change. But any other
change will cause the prompt to show up.



jk wrote:

I have the following code:

Private Sub Workbook_Open()
Worksheets(1).Range("A1").Value = Now()
End Sub

This shows current date and time but i only need it to change if workbook is
modified. This code will be within a workbook that is sent from one country
to another and needs to maintain its orginal timestamp.Can this be done?


--

Dave Peterson

jk

Timestamp Saved
 
I have a complie error appear to to a forms on open work book:

Private Sub Workbook_Open()
UserForm4.Show
End Sub

Is there a way to get around this ????

"Dave Peterson" wrote:

But if the user chooses to close without saving, then the change in the
workbook_open event will be lost.

If the user chooses to save, then your change is kept.

If you don't want your change to mark the workbook as "dirty" (changed without
being saved), you could use:

Private Sub Workbook_Open()
me.Worksheets(1).Range("A1").Value = Now
me.saved = true
End Sub

Then the user won't be prompted to save because of this change. But any other
change will cause the prompt to show up.



jk wrote:

I have the following code:

Private Sub Workbook_Open()
Worksheets(1).Range("A1").Value = Now()
End Sub

This shows current date and time but i only need it to change if workbook is
modified. This code will be within a workbook that is sent from one country
to another and needs to maintain its orginal timestamp.Can this be done?


--

Dave Peterson


JLGWhiz

Timestamp Saved
 
Maybe give UserForm4 a name?

"jk" wrote:

I have a complie error appear to to a forms on open work book:

Private Sub Workbook_Open()
UserForm4.Show
End Sub

Is there a way to get around this ????

"Dave Peterson" wrote:

But if the user chooses to close without saving, then the change in the
workbook_open event will be lost.

If the user chooses to save, then your change is kept.

If you don't want your change to mark the workbook as "dirty" (changed without
being saved), you could use:

Private Sub Workbook_Open()
me.Worksheets(1).Range("A1").Value = Now
me.saved = true
End Sub

Then the user won't be prompted to save because of this change. But any other
change will cause the prompt to show up.



jk wrote:

I have the following code:

Private Sub Workbook_Open()
Worksheets(1).Range("A1").Value = Now()
End Sub

This shows current date and time but i only need it to change if workbook is
modified. This code will be within a workbook that is sent from one country
to another and needs to maintain its orginal timestamp.Can this be done?


--

Dave Peterson



All times are GMT +1. The time now is 01:16 PM.

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