get selected InlineShapes ID

G

ghost01

I have word documents where lot of times need to replace tables fro
excel paste as windows metafile then resize to 70%. The normal method i
very time consupting.
I tried to write a macro which delete the old table (win metafile
InlineShapes), then insert the new table (which is on the clipboard) a
a win metafile (InlineShapes) then resize it.
The macro working until resizing.
Resize is also working if I know the InlineShape ID, but I unable to ge
what is the ID of the actually inserted InlineShape. I have approx. 5
InlineShapes and I replace eg. 10-35 the InlineShapes, but the ID-
always different.
I couldn't find any method to get InlineShape ID in that line where th
cursor stays or get the pasted InlineShape ID.

Here is the macro:

Sub Paste_resize()
Selection.Delete
Selection.PasteSpecial Link:=False, Placement:=wdInLine
DataType:=wdPasteMetafilePicture, DisplayAsIcon:=False
ActiveDocument.InlineShapes(1).ScaleHeight = 70
ActiveDocument.InlineShapes(1).ScaleWidth = 70
End Sub

Have anybody an idea to solving this problem?

Thanks
 
G

ghost01

I solved the problem, not so nice code but working...

1. delete the selected part (shape or text)
2. insert the content from clipboard as a windows metafile as a shape
3. resize
4. convert to inplaneshape

Sub Paste_resize()
Selection.Delete
Selection.PasteSpecial Link:=False
DataType:=wdPasteMetafilePicture, Placement:=wdFloatOverText
DisplayAsIcon:=False
With ActiveDocument.Shapes(ActiveDocument.Shapes.Count)
.Width = .Width * 0.7
.ConvertToInlineShape
End With
End Su
 
A

Aries86

That's okay, there will be another one along in a while and that wil
save opening another thread
 

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