• Last Shape added (2003 SP2)

    Author
    Topic
    #445210

    Following from this post, is there a better way to get the Shape that was just added to the slide from the macro?

    lngActvSlide = Powerpoint.ActiveWindow.View.Slide.SlideID
    With Powerpoint.ActivePresentation.Slides.FindBySlideID(lngActvSlide)
    lngLastShape = .Shapes.Count
    With .Shapes(lngLastShape)
    … do stuff (more questions to come grin)

    Viewing 0 reply threads
    Author
    Replies
    • #1078937

      The code

      lngActvSlide = Powerpoint.ActiveWindow.View.Slide.SlideID
      With PowerPoint.ActivePresentation.Slides.FindBySlideID(lngActvSlide)

      is overkill, you can simply use

      With Powerpoint.ActiveWindow.View.Slide

      Perhaps you can tweak the following example to suit your purpose:

      With ActiveWindow.View.Slide
      With .Shapes.PasteSpecial(DataType:=ppPasteHTML)
      With .Shadow
      .ForeColor.RGB = RGB(0, 0, 128)
      .OffsetX = 5
      .OffsetY = -3
      .Transparency = 0.5
      .Visible = True
      End With
      End With
      End With

      • #1078955

        Ka-ching! And, magically, my Shape formatting code is working, so, no further questions Thanks for your help, Hans!

      • #1078961

        Does this not work

        Dim oshp As ShapeRange
        With ActiveWindow.View.Slide
        Set oshp = .Shapes.PasteSpecial(DataType:=ppPasteHTML)
        ‘oshp.dowhatever
        End With

    Viewing 0 reply threads
    Reply To: Last Shape added (2003 SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: