Hey, Stephen. Well, I stumbled upon the solution to my problem with unwanted
hard returns appearing between two segements of concatenated text (previous
message). Seems that the "" I put at the beginning of the code (to clear the
compilation rich textbox control) was causing it.
Thus, changing the code from this:
Me.rtfCompilation = ""
Me.rtf1.SelStart = 0
Me.rtf1.sellength = Len(Me.rtf1)
Me.rtfCompilation.SelText = Me.rtf1.SelRTF
Me.rtf2.SelStart = 0
Me.rtf2.sellength = Len(Me.rtf2)
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.SelRTF
to this:
Me.rtf1.SelStart = 0
Me.rtf1.sellength = Len(Me.rtf1)
Me.rtfCompilation = Me.rtf1.SelRTF
Me.rtf2.SelStart = 0
Me.rtf2.sellength = Len(Me.rtf2)
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.SelRTF
resolved the problem. (Removed the first line and changed the fourth line
from "rtfCompilation.SelText =" to "rtfCompilation =".)
Still not sure why the "" at the beginning caused the extra hard return to
appear at the end of that block. But at least it's cleared up.
<>
On a separate note, I realized that since I'm concatenating the entire
contents of the controls, that I could just use the TextRTF property, rather
than the SelRTF property. Thus, I modified the above code further to:
Me.rtfCompilation = Me.rtf1.TextRTF
Me.rtfCompilation.SelStart = Len(Me.rtfCompilation)
Me.rtfCompilation.SelText = Me.rtf2.TextRTF
Do you see any problem with that?
Thanks!!
Neil
Stephen Lebans said:
If you do not want to work directly with the RTF encoding then simply
cocatenate the values of the existing RTF controls into a new RTF control.
Use the Selxxx props/methods to select the complete contents of one
control, grab the RTF Selection, set your insertion point within the new
RTF control, set the SelText prop of the new control, and so on.
Add another control that contains nothing but a carriage retunr and follow
the same logic as above to select and copy the contents into the new
cocatenated RTF control.
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
King Ron said:
No, we're dealing with rich textboxes here. Each box is a self-contained
RTF
statement. You can't concatenate them with vbCrLf.
Using the MS Rich Textbox Control 6.0 in Access 2000, I need to
concatenate
several RTB controls into a single RTF file. Sometimes two strings
will
be
side-by-side; other times they need to be separated by a hard return.
For example, say I have the following 4 RTB controls in my form:
RTB1 = "abcd"
RTB2 = "efgh"
RTB3 = "ijkl"
RTB4 = "mnop"
The resulting RTF document might need to look like this:
abcdefgh
ijkl
mnop
Using the SaveFile method works great for a single RTB control. But
how
can
I concatenate the contents of two or more controls into a single RTF
file,
and how can I insert hard returns between sets of text?
Thanks!
Neil
In this case, and assuming the format is constant:
wkText = RTB1 & RTB2 & vbCrLf & vbCrLf & RTB3 & vbCrLf & vbCrLf &
RTB4
vbCrLF is the VB constant shorthand for the carriage return/linefeed
combination.
You could also concatenate 'Chr$(13) & Chr$(10)' instead of the
constant. If the structure is variable, the actual concatenation
sequence will be more complex but usually solvable. The inline 'If'
statement is quite useful for these puzzles.
iif([something],"concatenate" & "some things","concatenate" & "other"
& "things")
Lucks to yas!
Ron King of Chi
Well that water quickly got up over my head...
I'll have to play with one o them a lil' bit and get back atchas.
R, KOC