Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default textbox font style

Bert:

You can use a third-party rich textbox that uses the same underlying
technology that the Microsoft rich textbox does. FMS sells one that works
with Access; not sure if it works with Excel. Also Stephen Lebans has one on
his website -- again, designed for Access, but might work with Excel. And
there are other third party add-ons.

What others have done is created a VB wrapper for the control and created
their own OCX.


"Bert" wrote in message
news:wbpVj.15277$Au2.11772@trnddc07...
I've done a little checking. I have the control, but when I try to place
it on a UserForm, I get an error message (The subject is not trusted for
the specified action".) Seems that beginning with Office 2003, there were
security rules put in place that prevents its use. I found a MSDN message
that shows a fix involving a registry change:
Registry Key :
HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX
Compatibility\{3B7C8860-D78F-101B-B9B5-04021C009402}


Change the "Compatibility Flags" DWORD value to 0 (0x400 is kill bit). Now
you'll get prompted to trust loading the control and it will run.

But...I'm not sure I want to mess with the registry settings on the other
machines this workbook (and UserForm) will be used on.
Thanks for your help, though. If I decide to proceed, I have the control
I need!

Bert


"Rick Rothstein (MVP - VB)" wrote in
message ...
I have a Rich TextBox available to me, but I am not sure if it came with
my compiled version of VB (I make use of it on that version of VB all the
time) or it is a natively available Windows control. If you haven't
already done so, right-click the UserForm's Toolbox and select "Additional
Controls" from the popup menu that appears. Scroll the list looking for
this exactly worded item...

Microsoft Rich Textbox Control 6.0 (SP6)

although I'm not so sure that the 6.0 (SP6) won't be different on
different systems. If you see it in the list, mark its check box and you
will be able to use it. I guess the only danger if you are giving your
UserForm code to others is they may not have this control available to
them (that would be the case if the control actually comes with a program
that installs the compiled version of VB6). The reason I'm afraid it
comes with the compiled version of VB is that SP6... my version of
compiled VB is at Service Pack 6 and my version of Vista is not.

Rick


"Bert" wrote in message
news:CynVj.3655$mc1.3570@trndny08...
Rick:
Thanks for that information. I've been poking around and came across a
control called richtextbox, but I don't think it's available to VBA.
The problem with your solution is, I have to use it in an existing
Userform. But what you've described is exactly what I'd like to be able
to do.
Thanks.

"Rick Rothstein (MVP - VB)" wrote
in message ...
The ActiveX TextBox does not support differing font treatments for
parts of its text, so UserForm TextBoxes are out as are those directly
on the worksheet if from the Visual Basic toolbar. However, you can use
a TextBox Shape object from the Drawing toolbar (directly on your
worksheet) which does support the individual font treatments you are
seeking. If you place the TextBox on the worksheet manually (and
assuming its name is the default "Text Box 1"), then this code can be
used (as a guideline) to fill it with text and change the font
treatment of a part of it...

Sub MakeTextBold()
With Worksheets("Sheet1").Shapes("Text Box 1").TextFrame
.Characters.Text = "Read 'Your Book Title' today!"
With .Characters(7, 15).Font
.Bold = True
.Italic = True
.Underline = True
End With
End With
End Sub

If you need to do this only one time, you can create the TextBox
directly from code and then fill it as you wish. Here is some sample
code you can use as a guideline for that...

Sub MakeTextBold()
With Worksheets("Sheet1")
.Shapes.AddTextbox msoTextOrientationHorizontal, 100, 200, 200, 20
With .Shapes(.Shapes.Count).TextFrame
.Characters.Text = "Read 'Your Book Title' today!"
With .Characters(7, 15).Font
.Bold = True
.Italic = True
.Underline = True
End With
End With
End With
End Sub

Rick


"Bert" wrote in message
news:bliVj.2121$mc1.88@trndny08...
Is there a way to use font styles (bold, italic, underline) in a
textbox, that is, with some text, I'd like to add a style to a portion
of the text, e.g., a book title, but leave other text "normal". Is
this possible, and if so, if I copy the contents of a textbox to a
cell, does the style information transfer as well?
Thanks










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
Change the Font Style in VBA justme0010[_2_] Excel Discussion (Misc queries) 1 January 15th 08 04:07 AM
font style of worksheet functions gvm Excel Worksheet Functions 4 January 20th 06 08:30 PM
macro_change font style tommy_gtr[_2_] Excel Programming 6 August 10th 05 02:31 PM
macro_change font style dominicb[_84_] Excel Programming 1 August 9th 05 01:51 PM
how do i get font style back on toolbar? melissa Excel Discussion (Misc queries) 2 July 18th 05 08:55 PM


All times are GMT +1. The time now is 07:38 PM.

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

About Us

"It's about Microsoft Excel"