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

Re: Adding shapes... by Helmut

Helmut
Tue Oct 19 17:50:32 CDT 2004

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/


Re: Adding shapes... by Robin

Robin
Wed Oct 20 11:33:05 CDT 2004

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.

"Helmut Weber" <elmkqznfwvccbf@mailinator.com> wrote in message
news:pp5bn0tovmtl6ucck3cot0vhdn2ej7qr38@4ax.com...
> 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/
>