Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2007

Tip: Looking for answers? Try searching our database.

Drawing shapes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fuzzhead - 28 Feb 2007 06:59 GMT
The following macro insert a textbox with the $ sign in it. How do I get out
of the textbox and back into the main document after it runs?

Dim textbox As Shape
Dim i
i = Selection.Information(wdVerticalPositionRelativeToPage)
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 35, _
   i - 5, 22, 24).Select
Selection.ShapeRange.TextFrame.TextRange.Select
Selection.Collapse
Selection.Font.Size = 14
Selection.TypeText Text:="$"
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Fill.Transparency = 0#
CommandBars("Stop Recording").Visible = False
Selection.ShapeRange.Select
Shauna Kelly - 28 Feb 2007 07:38 GMT
Hi

See
http://groups.google.com.au/group/microsoft.public.word.vba.general/browse_frm/t
hread/3c76f6aa05d1db4c


Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> The following macro insert a textbox with the $ sign in it. How do I get
> out
[quoted text clipped - 15 lines]
> CommandBars("Stop Recording").Visible = False
> Selection.ShapeRange.Select
Jezebel - 28 Feb 2007 07:44 GMT
Better to write your macro so you don't change the selection; then the
problem doesn't arise --

With ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 35,
Selection.Information(wdVerticalPositionRelativeToPage)
- 5, 22, 24)
   With .TextFrame.TextRange
       .Text = "$"
       .Font.Size = 14
   End With
   .Fill.Visible = msoFalse
   .Line.Visible = msoFalse
End With

But probably simpler still is to define your textbox, ready-formatted and
positioned relative to its anchor, as an Autotext entry; then just insert
it.

> The following macro insert a textbox with the $ sign in it. How do I get
> out
[quoted text clipped - 15 lines]
> CommandBars("Stop Recording").Visible = False
> Selection.ShapeRange.Select
Fuzzhead - 01 Mar 2007 03:13 GMT
Thank you for the help and info.

Fuzzhead

> Better to write your macro so you don't change the selection; then the
> problem doesn't arise --
[quoted text clipped - 33 lines]
> > CommandBars("Stop Recording").Visible = False
> > Selection.ShapeRange.Select
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.