Author Topic: Formatting for Mtext..  (Read 2267 times)

0 Members and 1 Guest are viewing this topic.

hardwired

  • Guest
Formatting for Mtext..
« on: March 19, 2008, 09:05:54 AM »
Hi,

Is there anyway to format Mtext with VBA. I see no properties for this but was wondering how i may make some text bold or oblique etc..

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Formatting for Mtext..
« Reply #1 on: March 19, 2008, 10:22:25 AM »
format codes for multiline text are in help.
Perhaps the best way to see how it works is to write some mtext how you want it then look in the properties window under contents.

hardwired

  • Guest
Re: Formatting for Mtext..
« Reply #2 on: March 19, 2008, 11:17:34 AM »
Ah, i see, right got that, but how do i arrange it so i can have the variable for the chosen StyleName property, instead of the \f font, which no matter how i change the style, the content won't change ans stays as Arial Narrow..

I have this as my formatted content:

{\fArial Narrow|b1|i0|c0|p34;REF:}

....So that will display as REF:


I would it had been something like this, if StyleX is declared as an AcadTextStyle, and set as the current text style or one chosen by the user:

Code: [Select]
Set REFtext = FCBlock.AddMText(REFtextPNT, 1#, "{" & StyleX & "|b1|i1|c0|p34;REF:}")

but of course this just displays it as: STYLUS BT|b1|i1|c0|p34;REF:

If i code it this way:
Code: [Select]
Set REFtext = FCBlock.AddMText(REFtextPNT, 1#, "{\fArial Narrow|b1|i1|c0|p34;REF:}")
REFtext.StyleName = StyleX

...it still won't change the font (i guess because its been hardcoded in the content formatting, but how do i NOT hardcode the font?..


Any ideas?


Bryco

  • Water Moccasin
  • Posts: 1883
Re: Formatting for Mtext..
« Reply #3 on: March 19, 2008, 09:07:18 PM »
If you need to make a font active then make it active before doing the mtext thing.
Like you were suggesting, don't force the font where there is no need.