Displaying Text With Layout in a Text Box
by Montana DOJ Help Desk » Wed, 22 Sep 2004 12:55:47 GMT
Word 2000
I've built a user form that contains a text box. I have the following code
to initialize a couple of values in the user form:
Private Sub UserForm_Initialize()
lblErrorMessage.Caption = ErrMsg
tbDataClip.Value = cbDataClip
End Sub
This basically works, but I've run into one small hitch that I can't seem to
solve. I would like the text box to display data like the following example
(Note that this is a test record, and not live data):
M*HR.MTHOT0000.MT0000000.*ABCTSTIUL9.
MONTANA HOT FILE RESPONSE FOR LOCATE OF:
NAM/TEST, RECORD.OCA/TESTABC.DOR/20040812.LAC/TESTTOM.DSP/EXTR
LOCATED RECORD NOTIFICATION
MKE/LOCATED MONTANA WANT
ORI/MT0000000
NAM/TEST, RECORD DOB/19700101
SEX/M RAC/W HGT/600 WGT/210 HAI/BRO
DOW/20040812 OCA/TESTABC OFF/2002 ARSON-RESIDENCE-ENDANGERED LIFE
MIS/TEST RECORD
LOCATED/20040812 MT025015Y TESTTOM EXTR
MIN/W320581 DTE/20040812
MRI 448220 IN: MTSF 6933 AT 12AUG2004 22:29:53 OUT: JLET00 537 AT
12AUG2004
22:29:53
Instead, the text box is displaying the data as a single unbroken row, with
the paragraph markers visible in the data string. I made sure that the Word
Wrap property of the text box is enabled. Is there some way to pass the
data to the text box so that the text box displays the data with the layout
intact?
-- Tom
State of Montana
Department of Justice Help Desk
"Making the world a safer place."
Re: Displaying Text With Layout in a Text Box
by Helmut Weber » Wed, 22 Sep 2004 16:41:00 GMT
Hi Tom,
how are the lines seperated?
They are displayed perfectly her and now,
whether I seperate them by or by a line feed.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Re: Displaying Text With Layout in a Text Box
by Montana DOJ Help Desk » Thu, 23 Sep 2004 10:21:25 GMT
Originally, the data comes from a text-based system and is pasted into Word.
We do this because the text-based system has no automation abilities to
speak of, but in Word we have macros to help process the data. Once in
Word, the lines are separated by but the overall layout of the data
remains the same. However, when I pass the same data to the text box in my
form, it appears in the text box as follows:
Line 1ine 2ine 3ine 4
and so on. The symbol is literally visible in the text box (as shown in
the above example).
FYI: The form that displays the data in the text box is part of my error
checking routine. Th reason that I want to get the layout right is that the
form gives the user the choice of discarding the data, or keeping it despite
the error. It is just easier for the end user to recognize the data and
make the proper decision if the data is laid out in the familiar format.
-- Tom
State of Montana
Department of Justice Help Desk
"Making the world a safer place."
Hi Tom,
how are the lines seperated?
They are displayed perfectly her and now,
whether I seperate them by or by a line feed.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Re: Displaying Text With Layout in a Text Box
by Helmut Weber » Thu, 23 Sep 2004 16:57:34 GMT
Hi Tom,
I think you have to find out, what weird characters
your text-based system uses as paragraph or linefeed
markers. Can you analyze them?
Like selecting text from an ordinary character before
the paragraph mark until an ordinary character after
it, plus stepping through the string and looking for
the asc-values of the single characters. If you find
something odd, you are one step further. One method
I use, if all search and replacements of the weird
characters or combinations of them fail, is to
select the odd line feed or paragraph, cut it out
and selection.typetext text:=vbcr.
HTH
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Re: Displaying Text With Layout in a Text Box
by Montana DOJ Help Desk » Fri, 24 Sep 2004 11:24:50 GMT
Helmut,
Thanks again for the help. Our text-based system uses chr(10) for line
breaks. However, it turns out that the problem was with one of the
properties of the text box. I had looked through the properties a number of
times, and I turned on the Word Wrap property, but that wasn't the problem.
Finally, I went into the VB Editor and typed in the name of my text box, and
when I put in the period a list of properties came up, and I went through
all of them, looking up in Help any that sounded promising. I ended up
finding the Multiline property, which governs whether or not a control can
display multiple lines. So I checked that property on my text box, and it
was set to False. I set it to True, and now the text box displays the data
in the format that I wanted. And, the symbol is no longer visible in the
text box. I guess that only shows up when Multiline is set to False, as an
indicator that the actual data contains multiple lines. Therefore, when you
see the symbol in a text box, it's probably a good bet that the Multiline
property is set to False.
I must have checked the text box properties 8 or 10 times, and just never
saw the Multiline property--one of those "couldn't see the forest through
the trees" things I guess.
-- Tom
State of Montana
Department of Justice Help Desk
"Making the world a safer place."
Similar Threads:
1.Text boxes keep moving after Format:Text Box:Layout:Advanced:
I'm using Word 2008 (12.1.5), OS X 10.5.6. I am trying to having two-column
text flow around tables and figures that I place in text boxes that I am
trying to anchor. After inserting and formatting the text boxes, I find that
revisions to certain text, or changing the spacing between certain text
boxes and the text causes the text box to 'jump' to another page. Only
certain text boxes seem to be 'volatile', but I cannot discern what setting I
may have implemented to cause this.
I use the Format:Text Box:Layout:Advanced path and set the text boxes with
absolute measurements relative to the margins. I have been activating the
'Lock Anchor' option, but no other option. I do not activate the 'Move
object with Text' option. I cannot detect any sign that I inadvertantly
formatted the text to affect the text box position. I cannot extract any
help from the Help.
2.Outlook displays Word text box layout out of order
My documents that have text boxes inserted copy/paste all out of order in
Outlook 2003.
The text boxes when pasted into Outlook also don't reposition when trying to
fix the layout. Help!
Crystal
3.How do I stop text in text boxes affecting text in other text box
I create family trees using text boxes in Word. I have a text box on page 1
which seems to be connected mysteriously to a text box on page 15. Whatever
I type in either one comes up in the other. Are they linked? How? Can I stop
it?
4.Typing text is impossibly slow in text boxes when in publishing layout
Version: 2008
Operating System: Mac OS X 10.6 (Snow Leopard)
Processor: Intel
When I try to type or edit text in a text box in a template document (a newsletter template) the typing, editing, deleting, backspacing or what ever, is absolutely impossibly slow. Am I doing something wrong or do I have something set up wrong. If it remains this way I will not be able to work in this program.
5.layout wrapping text around text boxes in word 2000
When I use the layout mode with text boxes and try to wrap text around the
box the text outside the box moves leaving blank spaces.
6. change the layout of the text boxs via format text box window
7. Search for text box formatted to Layout: In line with text
8. Displaying formatted text in a text box control.