Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PowerPoint 2003 macro error

    PowerPoint Macro Question

    I am using PowerPoint in MS Office 2003.

    I recorded a macro while working on a presentation and I seem to recall it asking me where I wanted to save the macro. I chose the option “save in document” or something like that.

    The macro takes the selected photo, moves it to the front, Using the Draw option in a toolbar; then puts a green frame around it using the Format>Picture -> Color and Lines Tab -> drop down Color select color, change Weight value (line thickness);Then I Click on STOP Recording Macro.

    This document became huge (over a Gig) and cumbersome to use, so I did a ”Save As” and created a new document and deleted a bunch of slides and proceeded to continue with creating the presentation. (As info, I will use the compress option to reduce the presentations later and save under a different name for use when I run them.)

    I continued creating the slide show in the new document. When I went to run the macro, I get the following error.

    PowerPoint Macro Error-01.doc

    I also get the windows popping up below.

    PowerPoint Macro Error-02.doc


    I have recorded new macros duplicating the first macro that worked but the resulting behavior is not what I recorded.

    One version of the macro just moves another graphic on the slide. Another version puts the green frame around the wrong graphic.

    Does anyone have any suggestions on how to make it work?

  2. #2
    3 Star Lounger
    Join Date
    Feb 2007
    Location
    Durham, Durham, United Kingdom
    Posts
    280
    Thanks
    0
    Thanked 6 Times in 6 Posts
    The macro recorder in PowerPoint nearly always comes up with code you cannot use in a real situation. Sometimes it's a useful pointer but rarely if ever robust usable code.

    Try this code instead:

    (ALT f11 to open the vb editor
    Delete the existing code and paste in this)

    Sub ab4Pic()
    If ActiveWindow.Selection.Type = ppSelectionNone Then GoTo err1
    If ActiveWindow.Selection.ShapeRange.Count <> 1 Then GoTo err2
    With ActiveWindow.Selection.ShapeRange(1)
    .Line.Weight = 1.5
    .Line.ForeColor.RGB = RGB(0, 255, 0)
    .ZOrder (msoBringToFront)
    End With
    normalexit:
    Exit Sub
    err1:
    MsgBox "You don't have anything selected!", vbCritical
    GoTo normalexit
    err2:
    MsgBox "Select ONE shape!", vbCritical
    GoTo normalexit
    End Sub
    Last edited by JohnWilson; 2013-01-05 at 13:12.

  3. #3
    New Lounger
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. I'll try it.

Tags for this Thread

Posting Permissions

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