Question

I'm writing a PPT add-in that makes a PNG of a slide and uploads it somewhere. I want the slide creator to be able to add dates/times in text boxes (using Insert > Date & Time), and have those dates/times reflect the time the snapshot is taken.

If one checks "Update Automatically" when adding them, the timestamps only update when the slide is opened. Is there a way to find all the date/time tags/fields in all shapes and force them to update immediately before I take the snapshot?

The only other way I've found to possibly do what I want is to have "named" shapes on the slide that are empty and populate a date into them programmatically...but this introduces extra complexity for the person building the slide and is generally messier. But I'm open to other possibilities if any.

Thanks!

-EDIT-

Ok, I just realized that when I create the PNG with SaveGraphic the timestamps in the PNG are updated! So that probably is all I absolutely need. Interestingly though, the datestamps in what the user is looking at on-screen don't get updated, which is potentially confusing to the user. So the question still stands...seems like this should be doable.

Was it helpful?

Solution

Well, the bad news is you can't. The field (either as a Footer or input from e.g. TextRange.InsertAfter.InsertDateTime DateTimeFormat:=ppDateTimeMMddyyhmmAMPM, InsertAsField:=msoTrue) works like this:

The DateTime will update when you run the slide deck only in the slide show window. When you exit that slide show window, you will see the earlier date/time of when the field was either inserted or or the presentation was opened. The field updates in the editing windows when the presentation is opened or inserted the first time.

There are only two ways to handle a situation like this:

  1. Force a close/reopen of your PowerPoint deck (which is an awful solution, but I had to mention it).
  2. Don't use the DateTime field the way you have been. What I mean by this is to control the date/time manually. You can still use Insert Date/Time, but manage the text boxes where it is inserted so that you remove what is in that text box and repopulate it with a new .InsertDateTime each time you need it, such as before the Slide.Export you are doing.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top