Adding shapes...

R

Robin Tucker

How can I add a shape at the current cursor position using VBA? I would
like to add a small rectangular box. Is this possible?


Thanks
 
H

Helmut Weber

Hi Robin,
you'll have to distinguish between shapes and inlineshapes,
which move with the text. If you want a shape, delete the last line.
There may be other methods, too.
Seems that the macro recorder only supports insertion
of inlineshapes. Could be handled easily.
But note, some characters might be behind the shape after conversion.
Dim oShp As InlineShape
Set oShp = Selection.InlineShapes.AddPicture( _
FileName:="C:\test\test.bmp", _
LinkToFile:=False, _
SaveWithDocument:=True)
oShp.ConvertToShape
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
R

Robin Tucker

Ok, that makes sense, kindof. I think I'll just make some bitmaps to
represent my different colours rectangles and not bother with the conversion
(ie. keep them as inlineshapes.). I just have 4 different types anyway.
 

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