Immediately name a shape when it's copied into Powerpoint

N

Nickis

Hi,
To set the stage - I dabble in writing VBA macros in Excel and seem to
muddle through okay using online and book reference. However, I'm new to
creating macros in Powerpoint and it's not nearly so clear cut.

I'm using Powerpoint 2003 and VBA. I found the following code on this site
to create a name for a shape immediately as it's added to a slide, and it
works great! How do I modify this code to immediately name a shape that's
being COPIED into a slide from Excel? I've tried all sorts of variables that
I could piece together but nothing seems to work. I'm copying in a 3x25
table that I will in turn be taking data from and pasting a different slide
in the same presentation.

Sub addashape()
Dim oshp As Shape 'object variable
'set oshp to added shape
Set oshp = ActivePresentation.Slides(1).Shapes _
..AddShape(msoShapeRectangle, 10, 0, 100, 58)
'use oshp as reference
With oshp
..Name = "myshape"
'any other properties here
End With
End Sub

Thanks for any help!

Nicki
 
N

Nickis

John,
Thanks for your suggestion. I guess this is more complicated than I
realised. This doesn't work because the "shape" I am pasting is actually
more than one shape, it's a 3x25 table. I am getting an error that "...the
command cannot be applied to a shape range with multiple shapes".

Nicki
 
N

Nickis

Thanks...that works, but doesn't help me as much as I thought it would.

After copying the table (3 rows buy 25 columns), I need to copy text from
each column individually to paste into existing tables on different slides.
It looks like I need to name each column in my imported table individually.
Again, I've tried various compilations of code, but can't get this to work at
all. I thought I could just reference the "cells" in the named table, but
don't seem to be getting the code right. I'm used to relying heavily on the
macro recorder, but this isn't as helpful in Powerpoint. I think I'm just
out of my depth here. If you're able to provide any additional help or
suggestions it would be appreciated.

Nicki
 
N

Nickis

Thanks for all your help. With some minor changes (that somehow I figured
out), I have this working like I wanted! There's no way I could have got
this without your help.

Thanks again!
Nicki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top