font-information in arrays

M

Martin Müller

Dear experts,

is there any way in VBA to store strings in an array
whereby their bold- and sub-/superscript-information is
preserved? Up to now, I find that a string that contains
indices as subscripts loose the subscript information (or
any font-information, presumably) when this string is
stored in an array (via array(i) = Selection.Text) and
subsequently typed out (via Selection.TypeText Text:=array
(i)). Bold-information could be reproduced, but the loss
of the subscripts deforms any sort of chemical formulae.

Best regards
Martin
 
J

Jonathan West

Hi Martin,

Unfortunately Word doesn't have a "formatted text" data type.

The best you can manage is an array of Range objects, where the formatted
text is stored somewhere within the document, and the Range variables
indicate where each bit of formatted text is.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
H

Helmut Weber

Hi Martin,
can't believe that bold information can be reproduced.
Must be an incident, in so far, as the position,
where the text was inserted, was bold anway.
Same applies to any formatting, AFAIK.
If it has to be, I would store the information
in a second word document.
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, W98
 
M

Martin Müller

Thank you for the information; as a solution I was
thinking about the 'copy' and 'paste' commands, that
preserve any formatting, so that the new arrangement of
all the strings (alphabetical order of formulae according
to elements therein) must be performed in 'real time'
which seems to me fault-prone.
Unfortunately I am not used to the work with range-
objects; could you please give a short script that for
example stores a string in an array of range objects, so
that I recognize where to start from?
Best regards
Martin
 

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