Enter Creation Date in cell

japumatrsi

New Member
Joined
Oct 18, 2003
Messages
11
I have set up a spreadsheet which will be protected, allowing only a few cells for data entry by users. Need to have one cell automatically enter the file creation date (and time would be great) and that date not change when the file is re-opened on another date. Is this possible in Excel? I hate to redo this into a Word form.
 
japumatrsi said:
How do I get it into the cell?

Code:
Private Sub Workbook_Open()
    Sheet1.Range("$A$1").Value = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
End Sub

This goes in the ThisWorkBook module (Right Click the Excel Icon to the left of "File" on the menu bar and choose view code. You will need to format your cell as Date and Time.

Or You can run this sub (from a regular module) one time and then lock the cell.
Code:
Sub ShowCreationDate()
Sheet1.Range("$A$1").Value = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
End Sub


HTH

lenze[/code]
 
Upvote 0
I tried the first module for ThisWorkBook. When I protected the sheet and saved it, then reopened a few minutes later, I got a run time error. When I tried the sub from a regular module, the time changed whenever I re-opened the file. Can you tell me what I am doing wrong?
 
Upvote 0
Make sure the target cell is unlocked and then protect the sheet. If that doesn't work, then we can add code to unprotect the sheet, insert the date, and reprotect the sheet. The time for creation date should not change. You should, however, be doing these in an existing workbook. Unfortunately, I'm currently at a machine now that doesn't have Excel, so I can't debug it for you. I'll check back later.

lenze
 
Upvote 0
japumatrsi said:
No luck, does not hold the time, changes. Any further help would be appreciated.

I don't know what is happening. I placed this code in the ThisWorkbook module

Code:
Private Sub Workbook_Open()
    Sheet1.Range("$A$1").Value = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
End Sub

I then unlocked $A$1 and protected the worksheet. I saved the file. When I reopen it, the date and time of creation appears in $A$1. It does not change with subsequent reopenings.

I also placed this code

Code:
Sub ShowCreateDate()
    Range("$A$2").Value = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
End Sub

in a regular module. I unlocked $A$2 and protected the sheet. I ran the code. The same creation date and time was displayed in $A$2. After saving and reopening several minutes late, NOTHING Changed.

Sorry

lenze
 
Upvote 0
There can only ever be one Creation Date. :wink:

To see what built in properties you have in your Excel version run this :-
(you can also check out Custom Properties)

Code:
Sub test()
    rw = 1
    Set ws = Worksheets.Add
    For Each p In ActiveWorkbook.BuiltinDocumentProperties
        ws.Cells(rw, 1).Value = p.Name
        rw = rw + 1
    Next
End Sub
 
Upvote 0
Am sorry, don't think I was clear on what I need to do. I'm designing a template for multiple users. They click on the template, open a fresh xls file with new creation date for that file which they save with customer's account info. They are not be to be able to type or alter the creation date in their new file. (Need to make sure the time is not changed after it is saved with a new file name.) It's a Change Order Form for our manufacturing plant which will be emailed to various parts of the plant.

So, what do you think?
 
Upvote 0

Forum statistics

Threads
1,226,883
Messages
6,193,492
Members
453,803
Latest member
hbvba

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top