Reply
 
Thread Tools Display Modes
  #1   Report Post  
ghost01 ghost01 is offline
Banned
 
Posts: 0
Default get selected InlineShapes ID

I have word documents where lot of times need to replace tables from excel paste as windows metafile then resize to 70%. The normal method is 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) as 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 get what is the ID of the actually inserted InlineShape. I have approx. 50 InlineShapes and I replace eg. 10-35 the InlineShapes, but the ID-s always different.
I couldn't find any method to get InlineShape ID in that line where the 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!

Last edited by ghost01 : April 16th 13 at 06:14 PM
  #2   Report Post  
ghost01 ghost01 is offline
Banned
 
Posts: 0
Default

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 Sub
  #3   Report Post  
Aries86 Aries86 is offline
Junior Member
 
Posts: 0
Default

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

Last edited by Aries86 : November 19th 14 at 09:11 AM
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Tab Selected Text Mike Kiekover New Users 3 December 27th 08 02:53 AM
How do I go to a selected page? RickMon Microsoft Word Help 2 June 25th 08 01:52 AM
i cant paste what i have selected shaz Microsoft Word Help 8 March 29th 07 08:06 PM
Selected Style gets updated from selected text wordspinster Page Layout 3 May 20th 06 07:41 PM
Selected text ambutchster Microsoft Word Help 1 January 27th 05 06:38 PM


All times are GMT +1. The time now is 10:55 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"