<p>I'm building an excel template (*.xlt) for a user here, and one of the things I want to do is have it insert the current date when a new document is created (ie, when they double-click the file in windows explorer).  How do I do this?</p>

<p><strong>Update:</strong> I should have added that I would prefer not to use any vba (macro).  If that's the only option, then so be it, but I'd really like to avoid forcing my user to remember to click some 'allow macro content' button.</p>

[{'answer_id': 40674, 'author': '1729', 'author_id': 4319, 'author_profile': 'https://Stackoverflow.com/users/4319', 'pm_score': 2, 'selected': False, 'text': '<p>You can edit the default template for excel - </p>\n\n<p>There is a file called <code>Book.xlt</code> in the <code>XLSTART</code> directory, normally located at <code>C:\\Program Files\\Microsoft Office\\Office\\XLStart\\</code></p>\n\n<p>You should be able to add a macro called Workbook_Open</p>\n\n<pre><code>Private Sub Workbook_Open()\n    If ActiveWorkBook.Sheets(1).Range("A1") = "" Then\n        ActiveWorkBook.Sheets(1).Range("A1") = Now\n    End If\nEnd Sub\n</code></pre>\n\n<p>My VBA is a little rusty, but you might find something like this works.</p>\n'}, {'answer_id': 40785, 'author': 'Graham', 'author_id': 1826, 'author_profile': 'https://Stackoverflow.com/users/1826', 'pm_score': 3, 'selected': True, 'text': '<p>You could use the worksheet function =TODAY(), but obviously this would be updated to the current date whenever the workbook is recalculated.</p>\n\n<p>The only other method I can think of is, as 1729 said, to code the Workbook_Open event:</p>\n\n<pre><code>Private Sub Workbook_Open()\n    ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = Date\nEnd Sub\n</code></pre>\n\n<p>You can reduce the problem of needing the user to accept macros each time by digitaly signing the template (in VBA IDE Tools | Digital Signature...) and select a digital certificate, however, you will need to get a certificate from a commercial certification authority (see <a href="http://msdn.microsoft.com/en-us/library/ms995347.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms995347.aspx</a>). The user will need to select to always trust this certificate the first time they run the template, but thereafter, they will not be prompted again.</p>\n'}, {'answer_id': 43285, 'author': 'paulmorriss', 'author_id': 2983, 'author_profile': 'https://Stackoverflow.com/users/2983', 'pm_score': 0, 'selected': False, 'text': "<p>To avoid VBA, and if you think your users might follow instructions, you could ask them to copy the date and then paste special->values to set the date so that it won't change in future.</p>\n"}]
['https://Stackoverflow.com/questions/40637', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3043/']