Using "wdPropertyTimeLastSaved" fon Userforms for Word.
-
Hello, This is perhaps not the best forum to post this but I've already posted to Microsoft's programming forum but have not recieved a reply. I have a question about the "wdPropertyTimeLastSaved" property in VBA for word. I have attached a userform with the following code in the initializing section of my project. The form is associated with a template that displays the form when the template is used. Essentially it displays text right on the form itself, containing the date that the template was last saved. It works great. However, there is a wrinkle in my design. Whenever, I make changes to either the template or the form, I am prompted each time I use my template, to save the template even though I did a save. I found a way around this problem, but I don't care for the solution. I must go into the VBA editor and run the form at least once and then save the associated template. That does the trick. No more prompts to save the template. However, I do not want casual users to have to go thru this extra work each time a change is made to the template and/or form. If you place this small snippet of code below in your own forms, you will know what I'm talking about. Any suggestions? Thanks. :) lblUFdate.Caption is an actual caption on my form which displays the date.
Private Sub UserForm_Initialize()
Dim SavedTime As Date
SavedTime = ThisDocument.BuiltInDocumentProperties( _
wdPropertyTimeLastSaved).Value
lblUFdate.Caption = "Last Updated " & Format(SavedTime, "dd-mmm-yyyy
HH:mm AM/PM")End Sub