Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default 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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeStamp Chris Excel Discussion (Misc queries) 2 April 19th 10 10:15 PM
How do I recover an Excel document saved not saved as Darryl Excel Discussion (Misc queries) 6 January 5th 10 03:39 AM
Timestamp juanpablo Excel Discussion (Misc queries) 3 November 2nd 07 01:55 PM
Timestamp PS Excel Discussion (Misc queries) 2 January 10th 07 02:21 PM
Timestamp Starryeyedmusician Excel Programming 1 February 5th 06 05:53 AM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"