Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Jan 2007
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Inserting yesterday's date into a presentation (2003)

    Is there a way of inserting YESTERDAY'S date into a presentation so that it updates each day? I know you can have TODAY'S date updating automatically but I need the slide(s) to always display the date for the previous day. Any ideas would be much appreciated. Thanks in advance.

  2. #2
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Inserting yesterday's date into a presentation (2003)

    Good morning

    I guess there is probably a Macro you could run but I am strictly a novice at such things, as a quick work around could you not change your PC or laptop date back by 1 day when showing the slide so today would be yesterday. I have Googled for an answer as well but no joy there, I will have a better look and play later.

    Cheers

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  3. #3
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Inserting yesterday's date into a presentation (2003)

    I think this could only be done with a macro

    You can get yesterday's date fairly easily if it helps
    Sub getyest()
    dim yesterday as Date
    yesterday=Now-1
    yesterday =Format(yesterday, "dd:mm:yy")
    msgbox yesterday
    End Sub

  4. #4
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Inserting yesterday's date into a presentation (2003)

    Hi John,

    Gill wanted the date to be inserted on the slide. I took the code you typed and inserted it into some additional code to do this. Also, I changed the colons you used in the date format to hyphens. The date displays as a time if colons are used.

    Gill,
    Try this code. It is very basic as I am not really familiar to VBA in PowerPoint. To make it worse, I notice that the Macro Recorder DOES NOT exist in PPT 2007 which I have on my PC, so I was fussing around trying to make it work in VBA directly. I am sure someone else with better VBA knowledge will be able to "fine tune" the code so that it runs more cleanly...
    Gill, just copy all the code below and paste it into a module in the appropriate presentation.

    - To do this choose Tools | Macro | Visual Basic Editor.
    - In the Editor window that opens, go to the menu and choose Insert | Module.
    - On the module, paste the code.
    - You will need to run the macro by choosing Tools | Macro | Macros.
    - Select the macro name and choose Run.

    Sub InsertYesterdayDate()
    Dim mySlide As Slide
    Dim yesterday As Date, NS As Integer
    yesterday = Now - 1
    yesterday = Format(yesterday, "mm-dd-yyyy")
    For Each mySlide In ActivePresentation.Slides
    NS = NS + 1
    ActivePresentation.Slides.Range(NS).Select
    ActiveWindow.Selection.SlideRange.Shapes.AddTextbo x(msoTextOrientationHorizontal, 19.75, 496.75, 124.75, 28.875).Select
    ActiveWindow.Selection.ShapeRange.TextFrame.WordWr ap = msoTrue
    ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Characters(Start:=1, Length:=0).Select
    With ActiveWindow.Selection.TextRange
    .Text = yesterday
    .Font.Size = 10
    End With
    With ActiveWindow.Selection.ShapeRange
    .ScaleWidth 0.8, msoFalse, msoScaleFromTopLeft
    .ScaleHeight 1.01, msoFalse, msoScaleFromTopLeft
    End With
    ActiveWindow.Selection.Unselect
    Next mySlide
    End Sub
    Regards,
    Rudi

  5. #5
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Inserting yesterday's date into a presentation (2003)

    The macro recorder doesn't very often give good code!

    Sub InsertYesterdayDate()
    Dim mySlide As Slide
    Dim otxt As Shape
    Dim yesterday As Date
    yesterday = Now - 1
    yesterday = Format(yesterday, "mm-dd-yyyy")
    For Each mySlide In ActivePresentation.Slides
    Set otxt = mySlide.Shapes.AddTextbox(msoTextOrientationHorizo ntal, 20, 500, 125, 20)
    With otxt.TextFrame.TextRange
    .Text = yesterday
    .Font.Size = 10
    End With
    Next mySlide
    End Sub

  6. #6
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Inserting yesterday's date into a presentation (2003)

    That is MUCH better than mine John. TX for the improvements. As I mentioned, VBA for PPT is not my strong point. I have very little knowledge of its object library. Your code has taught me a lot. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

    PS: I hope Gill finds it OK based on her original request.

    John, have you got any idea why the recorder was removed from PPT2007? Even though you say it does not give good code, it still helps to automate simple tasks. Without it novices like myself have to struggle through VBA procedures. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Regards,
    Rudi

  7. #7
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    286
    Thanks
    0
    Thanked 10 Times in 10 Posts

    Re: Inserting yesterday's date into a presentation (2003)

    I don't really KNOW but my guess is the vbeditor has just got too complex. Even in XP / 2003 many things were not recorded especially animation. Also it does not give good code. My golden rule is never use .SELECT unless it's absolutely necessary (it very rarely is). Still if you had a Mac with the latest version .... no vba!

  8. #8
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Inserting yesterday's date into a presentation (2003)

    No VBA... <img src=/S/drop.gif border=0 alt=drop width=23 height=23>

    Cheers!
    Regards,
    Rudi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •