Avatar of Fi69
Fi69

asked on 

Trouble pasting then picking up shape using VBA

Hi experts

I am trying to paste a shape (copied from a PDF document) and then pick it up and do stuff with it. Trouble is when I paste the image using the code below it doesn't pick it up.

Is there a way to declare the shape on paste?

For instance: Set oshp = selection.pastespecial placement:=wdfloatovertext
(this code errors by the way)

Dim oshp As Shape
     Selection.PasteSpecial placement:=wdFloatOverText
     
     Set oshp = Selection.ShapeRange(1)
     oshp.ConvertToInlineShape
     'go do something with oshp

Open in new window

Visual Basic ClassicMicrosoft Word

Avatar of undefined
Last Comment
Fi69
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Fi69
Fi69

ASKER

Hi Graham

Thanks so much for that. I've used the PasteInLine sub.  I wonder why I didn't use that in the first place...
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo