PowerPoint identify autodates

E

eedev

I need to programatically replace autodates in PowerPoint presentations with
a user specified string such as "<AUTODATE>". I can identify the autodates
in the HeadersFooters, but the dates inserted with Insert Date And Time with
automatic updates just appear as strings. Is there any way to identify these
as autodates?

I would appreciate any feedback. I've spent a lot of time in the debugger
and searching on the web with no luck.
 
S

Steve Rindsberg

I need to programatically replace autodates in PowerPoint presentations with
a user specified string such as "<AUTODATE>". I can identify the autodates
in the HeadersFooters, but the dates inserted with Insert Date And Time with
automatic updates just appear as strings. Is there any way to identify these
as autodates?

I would appreciate any feedback. I've spent a lot of time in the debugger
and searching on the web with no luck.

That *is* an odd one. I've had little better luck, but did notice that you can
find the inserted date in the HTMLProject. In 2003 you can use the Script
Editor to examine this, look for something like:

<span lang=EN-US style='mso-field-code:meta8'>1/16/2009 10:12 AM</span>

Ah, but here's another way at it. This relies on selecting each character in
the text range of the shape you're testing. Slow!

Sub Ject()

Dim x As Long
Dim oTmpRng As TextRange
Dim oTmpSelection As TextRange
Dim oSh as Shape

' get a reference to the shape, then
With oSh.TextFrame
For x = 1 To .TextRange.Characters.Count

Set oTmpRng = .TextRange.Characters(x)

' when you hit the date range, this will select ALL
' the date text, not just one character:
oTmpRng.Select

' Get a new range from the current selection;
' Using oTmpRng for this won't work for some reason
Set oTmpSelection = ActiveWindow.Selection.TextRange

With oTmpSelection
Debug.Print .Characters.Count
' if > 1, then oTmpSelection represents your time/date code
End With

Next
End With

End Sub
 
E

eedev

The code you posted works well, but it does identify a few other auto
inserted values such as page numbers, etc. I was able to take care of that
by checking to see if the selected value was a date or not. As you said, it
could be very slow, but by limiting the text values I check to only the ones
that contain the two digit year, it is acceptable. Its definitely a solution
I would have never thought to try. Thanks very much.
 
S

Steve Rindsberg

The code you posted works well, but it does identify a few other auto
inserted values such as page numbers, etc. I was able to take care of that
by checking to see if the selected value was a date or not. As you said, it
could be very slow, but by limiting the text values I check to only the ones
that contain the two digit year, it is acceptable. Its definitely a solution
I would have never thought to try. Thanks very much.

And thank you for asking. I had no idea how to do it when I read your question, but
learned something along the way.
 

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