Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macros in PowerPoint (2000)

    Hello everybody!

    I've got a little problem (at least I hope it's little). First of all I have to explain I'm not a native speaker and am not working with the english but a german version. So it could be I don't know the correct technical terms to describe what I mean. Nevertheless I hope to make myself understood...
    So here's the topic: I want to activate Macros on mouseclick on an object (s.th. like hyperlinks or starting another application). When I click the mousebutton I want a little graphic to pop up, and on another click to disappear again. All this should happen during the running presentation...
    Is there the possibility to do s.th. like this? If so I would appreciate a little example.
    I know that I could realize this example also by using animation settings, but this one is not the real idea, just an attempt to get accustomed to the general process.
    Many thanks in advance!!

    <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

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

    Re: Macros in PowerPoint (2000)

    Your English is excellent. I flunked German in high school, so I'll have to stick to English.

    Here is a demo that may be interesting. I created a slide with a clipart. I created two macros:
    <pre>Option Explicit

    Sub NameGraphic()
    ActiveWindow.Selection.SlideRange.Name = "TestSlide"
    ActiveWindow.Selection.ShapeRange.Name = "TestShape"
    End Sub

    Sub ToggleGraphic()
    With ActivePresentation.Slides("TestSlide").Shapes("Tes tShape")
    .Visible = Not .Visible
    End With
    End Sub</pre>


    Then I added an image control to the slide and coded the click event:
    <pre>Option Explicit

    Private Sub Image1_Click()
    ToggleGraphic
    End Sub</pre>


    I selected the clip art and ran the NameGraphic macro. Now I can click the image during the presentation to toggle the graphic on and off.

    I have attached a zipped copy of the presentation. HTH --Sam
    Attached Files Attached Files
    <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
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Germany, Germany
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macros in PowerPoint (2000)

    Hello Sam!

    Thank you very much! It works perfectly, and now I'm able to transform this to the things I really want to do...
    Hope you didn't spend too much time on it!

    Greetings, Porley

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

    Re: Macros in PowerPoint (2000)

    Porley, no problem, that was a fun task. Just post if you need more help in writing the actual macro. PowerPoint VBA is ugly. --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>

  5. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Macros in PowerPoint (2000)

    Nifty!

    Sub ToggleGraphic()
    With ActivePresentation.Slides("TestSlide").Shapes("Tes tShape")
    .Visible = Not .Visible
    End With
    End Sub

    So the .visible = not .visible controls the "toggling" action?
    Hmmm I bet I could use this concept elsewhere ....
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

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

    Re: Macros in PowerPoint (2000)

    Sure, and ye'll become a flasher! But, be sure to put a space between the Not and the .Visible or you'll get a syntax error. I know you know this, but the font made the space almost invisible. Notice also that I use the with block to avoid having to type ActivePres... twice. To make the Visible concept more "visible" <img src=/S/duck.gif border=0 alt=duck width=23 height=23> I could write:
    <pre>Sub ToggleGraphic()
    dim shp as Shape
    Set shp = ActivePresentation.Slides("TestSlide").Shapes("Tes tShape")
    shp.Visible = Not shp.Visible
    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>

Posting Permissions

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