Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default text align code XL2000

When creating a form for Excel 2000, I realized that I need the actual vba
code for right-aligning text in a text box. I know how to do this using the
properties of the textbox, but for the sake of fault tolerance (users
deleting textbox by accident) and because it is wrapped in a macro, I need
code to do this.

This is what I currently have:

ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 281, 23.75, _
260, 25).Select
Selection.?????????

Any suggestions are welcome and greatly appreciated!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default text align code XL2000

Selection.HorizontalAlignment = xlRight

Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/


*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 268
Default text align code XL2000

Replace ???????? with .HorizontalAlignment = xlRight

My code actually looks as follows:
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlTop
.ReadingOrder = xlContext
.Orientation = xlHorizontal
.AutoSize = False
End With

"Jess" wrote:

When creating a form for Excel 2000, I realized that I need the actual vba
code for right-aligning text in a text box. I know how to do this using the
properties of the textbox, but for the sake of fault tolerance (users
deleting textbox by accident) and because it is wrapped in a macro, I need
code to do this.

This is what I currently have:

ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 281, 23.75, _
260, 25).Select
Selection.?????????

Any suggestions are welcome and greatly appreciated!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default text align code XL2000

Jess, give this code a try. It will add a text box like shape to the active
sheet, insert some text, and right-align the text.

Troy


Sub AddTextBoxShape()
Dim shp As Excel.Shape

Set shp = ActiveSheet.Shapes.AddTextBox( _
msoTextOrientationHorizontal, _
281, 23.75, 260, 25)

With shp.TextFrame
.Characters.Text = "Hello, I'm right aligned"
.HorizontalAlignment = xlHAlignRight
End With

Set shp = Nothing
End Sub

"Jess" wrote in message
...
When creating a form for Excel 2000, I realized that I need the actual vba
code for right-aligning text in a text box. I know how to do this using
the
properties of the textbox, but for the sake of fault tolerance (users
deleting textbox by accident) and because it is wrapped in a macro, I need
code to do this.

This is what I currently have:

ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 281, 23.75, _
260, 25).Select
Selection.?????????

Any suggestions are welcome and greatly appreciated!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
align text?? L.S. New Users to Excel 3 July 30th 09 01:42 AM
Align text in Excel? Mike Excel Discussion (Misc queries) 1 December 18th 08 05:43 PM
How to align text boxes? M.W. Excel Discussion (Misc queries) 1 August 18th 05 12:56 AM
Code works in XL2000 but not in XP!? Big Chris[_21_] Excel Programming 2 December 13th 03 03:57 PM
XL2000 VBA code to ACCESS 2000 Tom Rudski Excel Programming 1 August 20th 03 08:41 AM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"