ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Chemical formula with sub/superscript in TextBox, Label etc. (https://www.excelbanter.com/excel-programming/388923-chemical-formula-sub-superscript-textbox-label-etc.html)

Christian[_9_]

Chemical formula with sub/superscript in TextBox, Label etc.
 
Hi there,

At the moment I'm working on program for chemical calculations.
I created a Userform with a lot of TextBoxes and Labels for data
input.

Problem: I can't find a way to display chemical formulars (e. g. H20:
the "2" must be subscript) correctly in a textbox.caption or
label.value

Is there a way to enabel subscript or superscript for single
characters in a caption or label?

Thanx in advance for any advice,

- Christian


NickHK

Chemical formula with sub/superscript in TextBox, Label etc.
 
Christian,
In order to use such text formats, you need a control that supports Rich
Text Format.
The RTF box does.

Note that I now get an error "The subject is not trusted for the specified
action" when trying to use this control. AFAIK, this is the result of an
update.
A quick unregister then register of this control fixed it. If you get this
problem, maybe these will help:

http://support.microsoft.com/kb/827742
http://p2p.wrox.com/topic.asp?whichp...OPIC_ID=10894&

NickHK

"Christian" wrote in message
oups.com...
Hi there,

At the moment I'm working on program for chemical calculations.
I created a Userform with a lot of TextBoxes and Labels for data
input.

Problem: I can't find a way to display chemical formulars (e. g. H20:
the "2" must be subscript) correctly in a textbox.caption or
label.value

Is there a way to enabel subscript or superscript for single
characters in a caption or label?

Thanx in advance for any advice,

- Christian




GysdeJongh

Chemical formula with sub/superscript in TextBox, Label etc.
 
"Christian" wrote in message
oups.com...
Hi there,

At the moment I'm working on program for chemical calculations.
I created a Userform with a lot of TextBoxes and Labels for data
input.

Problem: I can't find a way to display chemical formulars (e. g. H20:
the "2" must be subscript) correctly in a textbox.caption or
label.value


Hi Christian,
you need the Rich Textbox (Richtx32.ocx) instead of the Text Box.The problem
is that the Rich Textbox is nolonger trusted :(

See the discussions here (Remove the carriage returns inserted in the long
URL by the news reader) :

http://groups.google.co.uk/group/mic...49c56 9bb5369

http://groups.google.com/group/micro...b012e5230d7a81

Maybe you can use one of these :
Newsgroups: microsoft.public.excel.programming
From: Perico
Date: Mon, 19 Jun 2006 14:03:01 -0700
Local: Mon, Jun 19 2006 11:03 pm
Subject: Problem with RICHTX32.OCX

I had this problem. The solution for me was to use the msMask32.ocx
instead.

Newsgroups: microsoft.public.excel.programming
From: "RB Smissaert"
Date: Fri, 5 May 2006 23:06:07 +0100
Local: Sat, May 6 2006 12:06 am
Subject: Problem with RICHTX32.OCX

If you are interested I can mail you a RichTextBox control that behaves just
like the regular one but doesn't have this security problem.

RBS

hth
Gys



Jan Karel Pieterse

Chemical formula with sub/superscript in TextBox, Label etc.
 
Hi Christian,

Is there a way to enabel subscript or superscript for single
characters in a caption or label?


No.

You could do this (character formatting I mean) with a textbox on a
dialogsheet way back in Excel 5. Excel still supports these dialog
sheets though.

Otherwise you'd have to use third party controls I think.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com


Jon Peltier

Chemical formula with sub/superscript in TextBox, Label etc.
 
A different approach is to find a font specifically designed with sub- and
superscripted numerals up where other infrequently used characters are
usually found. Here's the first link returned in a Google search:

http://www.chemsoc.org/networks/learnnet/RSCfont.htm

You could use this utility to figure out which character code provides the
appropriate character:

http://peltiertech.com/Excel/tricks.html#ascii

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Christian" wrote in message
oups.com...
Hi there,

At the moment I'm working on program for chemical calculations.
I created a Userform with a lot of TextBoxes and Labels for data
input.

Problem: I can't find a way to display chemical formulars (e. g. H20:
the "2" must be subscript) correctly in a textbox.caption or
label.value

Is there a way to enabel subscript or superscript for single
characters in a caption or label?

Thanx in advance for any advice,

- Christian




PBezucha

Chemical formula with sub/superscript in TextBox, Label etc.
 
Hi Christian,

I'd propose an additional diversion: accepting the inability of
sub-/superscript input, and, for the next treatment, using the procedure,
which converts numerals correctly. If you like, I'm able to mail a well-tried
sub.

Regards
--
Petr Bezucha


"Christian" wrote:

Hi there,

At the moment I'm working on program for chemical calculations.
I created a Userform with a lot of TextBoxes and Labels for data
input.

Problem: I can't find a way to display chemical formulars (e. g. H20:
the "2" must be subscript) correctly in a textbox.caption or
label.value

Is there a way to enabel subscript or superscript for single
characters in a caption or label?

Thanx in advance for any advice,

- Christian




All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com