Changing Fonts In A String

M

Mark Gould

I have inherited a messy program written in VBA. I have a line of code that reads

myString = "The quick brown fox jumps over the lazy dog

If I want "The quick brown dog" to be in normal text, "jumps over the" to be in small caps, and "lazy dog" to be in normal text how can this be done? Because I inherited this program I need to do everything in a variable string

Thank

Mark
 
J

Jonathan West

Mark Gould said:
I have inherited a messy program written in VBA. I have a line of code that reads:

myString = "The quick brown fox jumps over the lazy dog"

If I want "The quick brown dog" to be in normal text, "jumps over the" to
be in small caps, and "lazy dog" to be in normal text how can this be done?
Because I inherited this program I need to do everything in a variable
string.
Thanks

Mark

Sorry, it can't be done. You will have to insert the string into the
document and then apply the formatting.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Mark,

I don't believe that you can change the fonts in the string itself. You
would have to write the individual parts to a .Range and then apply the
formatting to the Range.

Give us some more information on the purpose of the overall program and we
can probably be more specific.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top