How to Paste Linked Object by VBA

G

Guest

I have been using the OLECopy command in access to copy an activated drawing
in Visio.

I next paste this into a power point side using:

oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank).Shapes.Paste

When I can going through the options, I can find how to pasted an Linked. I
also look into PasteSpecial.

Can some help??? I wish to paste a linked drawing into power point


Thank You!

G
 
S

Steve Rindsberg

I have been using the OLECopy command in access to copy an activated drawing
in Visio.

I next paste this into a power point side using:

oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank).Shapes.Paste

When I can going through the options, I can find how to pasted an Linked. I
also look into PasteSpecial.

Can some help??? I wish to paste a linked drawing into power point

In PowerPoint 2003 you can use .PasteSpecial instead of .Paste to accomplish
this. I don't think this is available in earlier PPT versions.
 
G

Guest

How do I know if I have the PasteSpeical ability.

I have check on a PPt 2000 and 2002 and when I start typing in the VBA
code, I can see the PasteSpecial on both, but the options after comes close
to Link is LinkFormat. I assume I don't have the ability (right)????

I assume in 2003, you will see Link as a option after PasteSpecial???

Gary
 
S

Steve Rindsberg

How do I know if I have the PasteSpeical ability.

I have check on a PPt 2000 and 2002 and when I start typing in the VBA
code, I can see the PasteSpecial on both, but the options after comes close
to Link is LinkFormat. I assume I don't have the ability (right)????

I'm not sure where you see PasteSpecial ... it's not here in 2000.

In a module, start:

ActivePresentation.Slides(1).Shapes.

At that point, you'll se PasteSpecial as one of the options in 2003; it's
definitely not available in 2000. I don't have 2002 handy to check right now.
Over to you on that ... ;-)
 
G

Guest

I do see PasteSpecial in 2002, but it doesn't work there.

This is what I did:

oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank).Shapes.Paste

'oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I tried this in 2002, and the PasteSpecial Link:=msoTrue didn't give any
compile error and gives a execution erorr.

Can I just that its not really available in PPT 2002 either???

Thanks,

Gary
 
S

Steve Rindsberg

I do see PasteSpecial in 2002, but it doesn't work there.

I had a chance to fire up 2002 and it does seem to work:

Dim oSl as Slide
Set oSl = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
call oSl.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

This works, assuming there's something on the clipboard in the first place.
If there's not, or if the requested data type isn't on the clipboard, you'll get an
error.

To test this, first copy your content to the clipboard manually, then use Edit, Paste
Special and look at the list of available paste options; if what you want isn't there,
it won't be available to VBA either.


Slides.Add(oPres.Slides.Count + 1,
 
G

Guest

Sorry to be so dumb, but I still get an error. I am testing it that these is
an object that I copied to a clip board. This is the code:

Do Until T.EOF
Forms![GenPPT]![OLEFile].Action = acOLECopy
oPres.PageSetup.SlideHeight = (8.5 * 1440) / 20
Set oSI = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
Call oSI.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste
oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue


I did an OLECopy from a access table and I did the PasteSpecial with the
extact commands you posted. I get the following error:

"Shapes (unknown member) invalid request. The specified data type is
unavailable.

I ran it with the command

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste

with out it being commented out and it generated a power point for me.

When I commend out the Paste and use the PasteSpecial it didn't work. If
it work for the Paste, it must have something in the clip board.

I am usng Power Point 2002 sp3.

What am I doing wrong???


Thanks,

Gary
 
S

Steve Rindsberg

Sorry to be so dumb, but I still get an error. I am testing it that these is
an object that I copied to a clip board. This is the code:

Do Until T.EOF
Forms![GenPPT]![OLEFile].Action = acOLECopy
oPres.PageSetup.SlideHeight = (8.5 * 1440) / 20
Set oSI = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
Call oSI.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste
oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I did an OLECopy from a access table and I did the PasteSpecial with the
extact commands you posted. I get the following error:

"Shapes (unknown member) invalid request. The specified data type is
unavailable.

Probably because you're not specifying a data type and the default data type,
whatever it might be, is not on the clipboard OR is not a type that can be linked.
I ran it with the command

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste

with out it being commented out and it generated a power point for me.

When I commend out the Paste and use the PasteSpecial it didn't work. If
it work for the Paste, it must have something in the clip board.

I am usng Power Point 2002 sp3.

What am I doing wrong???

Not reading my replies, I guess? ;-)

Again, do it manually or run your access code to put data on the clipboard. Then
in PPT, choose Edit, Paste Special and look at what's available. If you're asking
PPT to PasteSpecial a format that isn't there, you'll get an error. The very one
you ARE getting.



Thanks,

Gary

Steve Rindsberg said:
I do see PasteSpecial in 2002, but it doesn't work there.

I had a chance to fire up 2002 and it does seem to work:

Dim oSl as Slide
Set oSl = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
call oSl.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

This works, assuming there's something on the clipboard in the first place.
If there's not, or if the requested data type isn't on the clipboard, you'll get an
error.

To test this, first copy your content to the clipboard manually, then use Edit, Paste
Special and look at the list of available paste options; if what you want isn't there,
it won't be available to VBA either.


Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I tried this in 2002, and the PasteSpecial Link:=msoTrue didn't give any
compile error and gives a execution erorr.

Can I just that its not really available in PPT 2002 either???



Thanks,

Gary
:

How do I know if I have the PasteSpeical ability.

I have check on a PPt 2000 and 2002 and when I start typing in the VBA
code, I can see the PasteSpecial on both, but the options after comes close
to Link is LinkFormat. I assume I don't have the ability (right)????

I'm not sure where you see PasteSpecial ... it's not here in 2000.

In a module, start:

ActivePresentation.Slides(1).Shapes.

At that point, you'll se PasteSpecial as one of the options in 2003; it's
definitely not available in 2000. I don't have 2002 handy to check right now.
Over to you on that ... ;-)



I assume in 2003, you will see Link as a option after PasteSpecial???

Gary

:
 
G

Guest

I saw exactly what you were implying by manually doing the copy and paste or
pastespecial.

When I did it manually, the PasteSpecial was not available!!! So I used
the Paste.

This is what I discovered. The pasted object (visio drawing) was a Link
object from a Access table which was linked to a file in a folder, and the
path was given when I did it manually in power point.. The interesting
thing was that when I edited the power point that was generated using the
paste instead of PasteSpecial, any changes I did on that power point (when I
doulbe dlick the drawing to activate it) was reflected back to the original
Visio drawing!!

I thought that since it was not linked, the local copy was in power point
would not effect anyone other file??? It turns out that I could makes
changes to it (just a like a linked object, and the changes can be seen in
the source Visio file!!!

Is that what suppose to happen???? I don't mind!! Just wondering!!!


Thanks,

Gary

Steve Rindsberg said:
Sorry to be so dumb, but I still get an error. I am testing it that these is
an object that I copied to a clip board. This is the code:

Do Until T.EOF
Forms![GenPPT]![OLEFile].Action = acOLECopy
oPres.PageSetup.SlideHeight = (8.5 * 1440) / 20
Set oSI = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
Call oSI.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste
oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I did an OLECopy from a access table and I did the PasteSpecial with the
extact commands you posted. I get the following error:

"Shapes (unknown member) invalid request. The specified data type is
unavailable.

Probably because you're not specifying a data type and the default data type,
whatever it might be, is not on the clipboard OR is not a type that can be linked.
I ran it with the command

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste

with out it being commented out and it generated a power point for me.

When I commend out the Paste and use the PasteSpecial it didn't work. If
it work for the Paste, it must have something in the clip board.

I am usng Power Point 2002 sp3.

What am I doing wrong???

Not reading my replies, I guess? ;-)

Again, do it manually or run your access code to put data on the clipboard. Then
in PPT, choose Edit, Paste Special and look at what's available. If you're asking
PPT to PasteSpecial a format that isn't there, you'll get an error. The very one
you ARE getting.



Thanks,

Gary

Steve Rindsberg said:
I do see PasteSpecial in 2002, but it doesn't work there.

I had a chance to fire up 2002 and it does seem to work:

Dim oSl as Slide
Set oSl = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
call oSl.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

This works, assuming there's something on the clipboard in the first place.
If there's not, or if the requested data type isn't on the clipboard, you'll get an
error.

To test this, first copy your content to the clipboard manually, then use Edit, Paste
Special and look at the list of available paste options; if what you want isn't there,
it won't be available to VBA either.


Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I tried this in 2002, and the PasteSpecial Link:=msoTrue didn't give any
compile error and gives a execution erorr.

Can I just that its not really available in PPT 2002 either???




Thanks,

Gary
:

 
S

Steve Rindsberg

I saw exactly what you were implying by manually doing the copy and paste or
pastespecial.

When I did it manually, the PasteSpecial was not available!!! So I used
the Paste.

OK, that seems to check out.
This is what I discovered. The pasted object (visio drawing) was a Link
object from a Access table which was linked to a file in a folder, and the
path was given when I did it manually in power point.. The interesting
thing was that when I edited the power point that was generated using the
paste instead of PasteSpecial, any changes I did on that power point (when I
doulbe dlick the drawing to activate it) was reflected back to the original
Visio drawing!!

I'm only allowed near Access under armed adult supervision. ;-)

I don't know what a linked object is ... it might simply be a pointer to the actual
file, so that changes invoked elsewhere would point back into the file.

Can't say at this remove what's going on, I'm afraid.
I thought that since it was not linked, the local copy was in power point
would not effect anyone other file??? It turns out that I could makes
changes to it (just a like a linked object, and the changes can be seen in
the source Visio file!!!

Is that what suppose to happen???? I don't mind!! Just wondering!!!

Thanks,

Gary

Steve Rindsberg said:
Sorry to be so dumb, but I still get an error. I am testing it that these is
an object that I copied to a clip board. This is the code:

Do Until T.EOF
Forms![GenPPT]![OLEFile].Action = acOLECopy
oPres.PageSetup.SlideHeight = (8.5 * 1440) / 20
Set oSI = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutBlank)
Call oSI.Shapes.PasteSpecial(DataType:=ppPastePNG, Link:=msoFalse)

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste
oPres.Slides.Add(oPres.Slides.Count + 1,
ppLayoutBlank).Shapes.PasteSpecial Link:=msoTrue

I did an OLECopy from a access table and I did the PasteSpecial with the
extact commands you posted. I get the following error:

"Shapes (unknown member) invalid request. The specified data type is
unavailable.

Probably because you're not specifying a data type and the default data type,
whatever it might be, is not on the clipboard OR is not a type that can be linked.
I ran it with the command

'oPres.Slides.Add(oPres.Slides.,Count + 1,
ppLayoutBlank).Shapes.Paste

with out it being commented out and it generated a power point for me.

When I commend out the Paste and use the PasteSpecial it didn't work. If
it work for the Paste, it must have something in the clip board.

I am usng Power Point 2002 sp3.

What am I doing wrong???

Not reading my replies, I guess? ;-)

Again, do it manually or run your access code to put data on the clipboard. Then
in PPT, choose Edit, Paste Special and look at what's available. If you're asking
PPT to PasteSpecial a format that isn't there, you'll get an error. The very one
you ARE getting.
 

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