Determining when a file is last saved.

H

Harry-Wishes

Hello, I have a question about the "wdPropertyTimeLastSaved" property. 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.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top