It's not really a bug your code just won't work. The macro recorder doesn't
always (often in fact) produce good code. In this instance I guess you've
changed slides while recording but your macro doesn't know this.
If you post exactly what you are trying to do AND WHEN (eg in edit mode or
show mode) then I'm sure you'll get workable code.

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
I have a slide which would normally be hidden during the presentation,
on which are the standard boxes, arrows and so forth, that the
presentation writer is to use when making the presentation. On that
slide is a rectangle that would be used for a summary on a displayed
slide. The request is for a macro that will take place the rectangle
on the current slide during the the editing of the presentation. So
yes I did change slides when trying to make the macro, first to the
slide that holds the rectangle so the copy could be made and then to
the "current" slide on which the rectangle is to be displayed.
Regards
Richard
On Feb 17, 4:47 pm, John Wilson <john AT technologytrish.co DOT uk>
wrote:
> It's not really a bug your code just won't work. The macro recorder doesn't
> always (often in fact) produce good code. In this instance I guess you've
[quoted text clipped - 41 lines]
>
> - Show quoted text -
John Wilson - 17 Feb 2008 16:31 GMT
Change the Slide(3) to whatever slide the rectangle is on and try this
()assuming I've understood)
Sub get_rectangle()
With ActivePresentation.Slides(3).Shapes("Rectangle 48").Copy
ActiveWindow.Selection.SlideRange(1).Shapes.Paste
End Sub
If the slide with the rectangle is going to change you will need to use the
SlideID which won't change when more slides are added
use for example
With ActivePresentation.Slides.FindBySlideID(258).Shapes("Rectangle 48").copy
you can find a slide's ID with
Sub IDfind()
MsgBox ActiveWindow.Selection.SlideRange(1).SlideID
End Sub

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
> I have a slide which would normally be hidden during the presentation,
> on which are the standard boxes, arrows and so forth, that the
[quoted text clipped - 56 lines]
> >
> > - Show quoted text -
John Wilson - 17 Feb 2008 16:37 GMT
I should add that if that works for you you really should add some error
trapping. If the user doesnt have a slide selected the line
"ActiveWindow.Selection ..." will fail

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
> Change the Slide(3) to whatever slide the rectangle is on and try this
> ()assuming I've understood)
[quoted text clipped - 77 lines]
> > >
> > > - Show quoted text -
wadiuwant - 17 Feb 2008 21:34 GMT
On Feb 17, 6:37 pm, John Wilson <john AT technologytrish.co DOT uk>
wrote:
> I should add that if that works for you you really should add some error
> trapping. If the user doesnt have a slide selected the line
[quoted text clipped - 93 lines]
>
> > > > - Show quoted text -
Thanks for all the help.
I'll try to put it in practice tomorrow my time when I get to work.
regards
Richard
wadiuwant - 18 Feb 2008 07:22 GMT
> On Feb 17, 6:37 pm, John Wilson <john AT technologytrish.co DOT uk>
> wrote:
[quoted text clipped - 105 lines]
>
> - Show quoted text -
I changed the code to
Sub Copy_Rectangle()
With ActivePresentation.Slides(6).Shapes("Rectangle 48").Copy
ActiveWindow.Selection.SlideRange(1).Shapes.Paste
End Sub
When I run thos macro, I get a Compile error: Expected Function or
variable
The word ".Copy" is selected.
Regards
Richard
John Wilson - 18 Feb 2008 09:53 GMT
Sorry - slip of the mouse when copying!
Delete the word "With"

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
> > On Feb 17, 6:37 pm, John Wilson <john AT technologytrish.co DOT uk>
> > wrote:
[quoted text clipped - 119 lines]
> Regards
> Richard
wadiuwant - 18 Feb 2008 10:57 GMT
On Feb 18, 11:53 am, John Wilson <john AT technologytrish.co DOT uk>
wrote:
> Sorry - slip of the mouse when copying!
>
[quoted text clipped - 130 lines]
>
> - Show quoted text -
Again I say much thanks for your help. And I ask that you do not get
tired of my problem as I am still stuck with it.
I removed the "With" and found myself back with the "The item with the
specified name wasn't found" problem.
I decided to check the Slide ID and got 259. So I changed the code to:
Sub Copy_Rectangle()
ActivePresentation.Slides.FindBySlideID(259).Shapes("Rectangle
48").Copy
ActiveWindow.Selection.SlideRange(1).Shapes.Paste
End Sub
But I still got the "The item with the specified name wasn't found"
error.
So I'm left with the thought that the "Rectangle 48" may be wrong.
"Rectangle 48" was the description generated by the macro recorder. Do
you have a code for selecting a rectangle and getting it's ID?
Regards
Richard
John Wilson - 18 Feb 2008 11:17 GMT
Sub getname()
On Error GoTo errhandler
Dim strName As String
Dim strSlide As String
strName = ActiveWindow.Selection.ShapeRange(1).Name
strSlide = ActiveWindow.Selection.SlideRange(1).SlideID
MsgBox "The selected shape is " & strName & vbCrLf _
& "The slide ID is " & strSlide
Exit Sub
errhandler:
MsgBox "Did you select a shape?", vbCritical
End Sub
Be careful with spaces and capitals in the shape name you use.

Signature
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
> On Feb 18, 11:53 am, John Wilson <john AT technologytrish.co DOT uk>
> wrote:
[quoted text clipped - 156 lines]
> Regards
> Richard
wadiuwant - 18 Feb 2008 12:24 GMT
On Feb 18, 1:17 pm, John Wilson <john AT technologytrish.co DOT uk>
wrote:
> Sub getname()
> On Error GoTo errhandler
[quoted text clipped - 178 lines]
>
> - Show quoted text -
Thank you.
I ran getname. The selected shape is Rectangle 48. and the slide ID is
259.
So my identifiers seem to be correct.
However, I'm still stuck with the "The item with the specified name
wasn't found" error.
The debugger hilites:
ActivePresentation.Slides.FindBySlideID(259).Shapes("Rectangle
48").Copy
??????????
As an experiment I tried running my original faulty code (from the
first email) and the new code on the slide, which actually contains
Rectangle 48. No change. Still the same error with both.
Regards
Richard
John Wilson - 18 Feb 2008 15:06 GMT
Send me the slide if you want
John
-- email john AT technologytrish.co.uk
Amazing PPT Hints, Tips and Tutorials
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
> On Feb 18, 1:17 pm, John Wilson <john AT technologytrish.co DOT uk>
> wrote:
[quoted text clipped - 204 lines]
> Regards
> Richard