Results 1 to 8 of 8
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A scfeensaver in Powerpoint - problem (Office 2000)

    For reasons most bizarre, I'm trying to create a 'screensaver' in PowerPoint 2000. I have a folder of 50 odd graphic files which are all large BMPs and so, loading them each into a separate slide might test memory limits. So, I thought of inserting a picture, waiting a while, deleting the picture and inserting the next picture in the folder.

    It's all working very well except the "wait a while" part. I've tried timer, counted do loops etc to create a delay of about 5 seconds before deleting the graphic. But, I can't get the graphic to display unless I halt execution of the code. So, the user sees nothing while graphics invisibly get inserted and deleted. If I halt execution in any way before the delete command (eg. Ctrl-Break, Esc, checkpoint) the most recent graphic is visible.

    How can I make PowerPoint display the inserted graphic while the code is executing ?

    Many thanks.
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    No time to check it out but I think that if you insert Shyam Pillai's code to refresh current slide during the slide show, it might work. In your case, since you only have one slide you probably just need the one-liner, SlideShowWindows(1).View.GotoSlide 1. If this doesn't work, post back with your code and I'll try to fix it. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Sam, many thanks. The one line of code did the trick - I guess I just needed a way to interrupt the flow into my timer loop.

    Now, I'm left with another problem. I'm trying to create a way to interrupt the macro so that the user can stop the 'screensaver'. The only way I can find is Ctrl-Break. But that only pops up an error message which I can't trap - I've got an 'on error' line and look for err.number = 18 but it doesn't get trapped and goes to a halt exection error instead.

    Anyway, many thanks. It's looking good now.

    Garry
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Your best bet is to modify your code so that it generates a set of slides instead of a single slide. Then, you can put the presentation into an unattended loop or use one of the products listed on the PowerPoint FAQ to convert it into a screen saver.
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Ohio, USA
    Posts
    163
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Is there any way to see this code? I assume from your note that the code will read whatever number/file type of pictures in a certain folder and display them in a running PPshow? So you could use this for a "pre-presentation" show?

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Hopefully Gary will share his code with us. Here's what I had in mind. You will need to specify a valid home directory or add an API call to SHBrowseForFolder to allow the user to choose a directory. HTH --Sam
    <pre>Option Explicit
    '
    Sub PictureShow()
    Const strHome As String = "Cocuments and SettingssamMy DocumentsMy Pictures"
    Dim strFile As String
    Dim sld As Slide
    Dim shp As Shape
    strFile = Dir(strHome & "*.*")
    Do While strFile <> ""
    Set sld = ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutBlank)
    Set shp = sld.Shapes.AddPicture(FileName:=strHome & strFile, _
    LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, _
    Left:=1, Top:=1, Width:=1, Height:=1)
    shp.ScaleHeight 1, msoTrue ' scale picture to full size
    shp.ScaleWidth 1, msoTrue
    With ActivePresentation.PageSetup ' center picture
    shp.Left = (.SlideWidth 2) - (shp.Width 2)
    shp.Top = (.SlideHeight 2) - (shp.Height 2)
    End With
    strFile = Dir()
    Loop
    Set shp = Nothing
    Set sld = Nothing
    '
    ' Make slide master background black
    With ActivePresentation.SlideMaster.Background
    .Fill.Visible = msoTrue
    .Fill.ForeColor.RGB = RGB(0, 0, 0)
    .Fill.Transparency = 0#
    .Fill.Solid
    End With
    '
    ' Setup 5 seconds between slides
    With ActivePresentation.Slides.Range.SlideShowTransitio n
    .EntryEffect = ppEffectNone
    .AdvanceOnClick = msoTrue
    .AdvanceOnTime = msoTrue
    .AdvanceTime = 5
    .SoundEffect.Type = ppSoundNone
    End With
    '
    ' Setup show and run it continuously
    With ActivePresentation.SlideShowSettings
    .ShowType = ppShowTypeSpeaker
    .LoopUntilStopped = msoTrue
    .ShowWithNarration = msoTrue
    .ShowWithAnimation = msoTrue
    .RangeType = ppShowAll
    .AdvanceMode = ppSlideShowUseSlideTimings
    .PointerColor.SchemeColor = ppForeground
    .Run
    End With
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  7. #7
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Blimey ! There are quite a few things to work through in your responses. Many thanks.

    As I said, Sam's suggestion on refreshing worked well. Then, I realised I still have a timing problem - the loop seems too tight to enable the user to cancel the slideshow with the Esc key. Perhaps the problem is that I have just one slide. Anyway, I'll have a look at all your suggestions.

    I've copied my code below. It's not as pretty as Sam's - I also think it'd be better to insert a link to the file rather than a picture but, I'm doing this in my spare time so, it's going slowly.

    Cheers.
    GB

    Sub fakeScreenSaverBits()
    Dim fileList As New Collection
    Dim PauseTime, Start, Finish, TotalTime
    On Error GoTo error_code
    myPath = "cocuments and Settingsbrogartestwallpapers"
    'Populate a collection with all the file names in the folder
    MyFile = Dir(myPath, vbNormal)
    Do While MyFile <> ""
    fileList.Add Item:=MyFile
    MyFile = Dir
    Loop
    'Set up as a slideshow
    With ActivePresentation.SlideShowSettings
    .ShowType = ppShowSpeaker
    .LoopUntilStopped = True
    .Run
    End With
    'Allocate the first file and go into timer loop
    currentFile = fileList.Item(1)
    ActivePresentation.Slides(1).Shapes.AddPicture myPath & currentFile, False, True, 0, 0, 832, 624
    SlideShowWindows(1).View.GotoSlide 1
    GoTo loopIt
    'Code for looping through files starts here
    again:
    ActivePresentation.Slides(1).Shapes(1).Delete
    'Look in the collection for the next file to be the wallpaper, show it and refresh
    For num = 1 To fileList.Count
    If fileList.Item(num) = currentFile Then
    currentFile = fileList.Item(num + 1)
    Exit For
    End If
    Next
    ActivePresentation.Slides(1).Shapes.AddPicture myPath & currentFile, False, True, 0, 0, 832, 624
    SlideShowWindows(1).View.GotoSlide 1
    'Leave the picture on the screen for 3 seconds
    loopIt:
    PauseTime = 3 ' Set duration.
    Start = Timer ' Set start time.
    Do While Timer < Start + PauseTime
    Loop
    GoTo again
    error_code:
    If Err.Number = 9 Then 'Reached the end of the collection - go back to the beginning
    currentFile = fileList.Item(1)
    Resume Next
    ElseIf Err.Number = 18 Then 'Doesn't seem to work - perhaps because the break can't be trapped ?
    MsgBox "You pressed Break"
    Application.Quit
    Else
    MsgBox Err.Number & " " & Err.Description
    End If
    End Sub
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  8. #8
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: A scfeensaver in Powerpoint - problem (Office 2000)

    Sam,

    Many thanks for this code idea. Sorry for taking so long to get back (if you get this post !). I tried it but it takes a long time to load each image onto a separate slide - around about 1-1.5 seconds per image. So, the slide show doesn't start for minutes if there are a lot of images to go through.

    I had to make some changes to speed things up and fix the display. Setting Width to 768 and height to 576 worked better than 1 and 1 respectively. I also decided to link the images rather than saving in the ppt file - it would have been huge if I'd accidentally saved it !

    Anyway, I'm still plugging away at the timing problem. I might have to invent another kind of timing device !

    Cheers
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

Posting Permissions

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