View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default alignment of SOME text in a textbox

Dom explained on 6/17/2011 :
On Jun 16, 6:16*pm, "Clif McIrvin" wrote:
"Dom" wrote in message

...
[ ]

I'm using 2007. *Are we talking about the same thing? *By textbox, I
mean the textbox shape, what you get from the INSERT ribbon. *Not the
multiline text box you might see on a form. *Also, you must have an
actual new line, not just text that has wrapped automatically. *For
example, try "This is<CRa new line". *You can make "This is" align
left, and "a new line" align right.

-----------

Using the xl2010 macro recorder, I get this:

* * ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 153,
38.25, 150, _
* * * * 144.75).Select
* * Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters.Text = _
* * * * "This is " & Chr(13) & "A new Line" & Chr(13) & ""
* * With Selection.ShapeRange(1).TextFrame2.TextRange.Chara cters(1, 9).
_
* * * * ParagraphFormat
* * * .FirstLineIndent = 0
* * * .Alignment = msoAlignRight
* * End With

HTH!

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


Thanks, Cliff, but I'm guessing this only works in 2010, not 2007. I
get an "Object doesn't support this property" error.

Thanks, again, but I think it's a lost cause.

Dom


And so is why I suggested padding the 2nd line so it 'appears'
right-aligned. This has been a long standing workaround in VB for form
controls and so I don't see why it won't work in VBA. Nice to hear,
though, that 2010 has finally evolved to provide built-in capability
for this.<g

One thing I've found interesting is how often things that work in an
earlier version get axed in later versions. I'm speaking primarily
about v10 (xl2002). Though it's usually a case of the reverse scenario
(newer versions having features not available to earlier versions), I
can only conclude that diffs between v10 and v11 (xl2003) in this
regard were actually mistakes left in v10 that were fixed in v11. In
this regard, then, I have to be careful that what I do in xl2002 still
works in later versions. I admit to not checking this as often as I
should and so it's easy to see how folks can be misguided as a result.
(I hope my clients still using xl2002 upgrade soon<bg)

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc