Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format text in a string - in a textbox...

Status
Not open for further replies.

air1access

Technical User
Jan 27, 2008
123
US
I am tryin' to format text in a textbox on a report...
I need the words "GTWY" and "Schd Date" in bold font. The string can start with either "GTWY" or "Schd Date" or be in the middle of the string following right after a comma (","). How can I format the string to show only these words in bold font...??
Below is an example of what I'm working with...
Any suggestions or examples...??
Thanks in advance..!!
air1access

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strGTWY As String
Dim strSchdDate As String
Dim intLeft As Integer
Dim intTop As Integer

If Not IsNull(Me.txtWanChanges) Then

strGTWY = Left(Me.txtWanChanges, InStr(Me.txtWanChanges, " ") - 1)
'Instr(StringToCheck,StringToMatch,StartPosition)

strSchdDate = Mid(Me.txtWanChanges, InStr(Me.txtWanChanges, " ") + 1)

Me.CurrentX = Me.txtWanChanges.Left
Me.CurrentY = Me.txtWanChanges.Top
Me.ForeColor = vbBlue
Me.fontsize = 8
Me.FontBold = True
Me.FontName = "Arial"
Me.Print strGTWY & " "
Me.FontBold = False
Me.FontName = "Arial"
Me.CurrentY = Me.txtWanChanges.Top
Me.Print strSchdDate

End If

End Sub
 
Sorry mate but when it comes down to a more fundamental level, text boxes are of the class "simple text" which means properties apply to whole thing rather than any character(s).

You could investigate rtf (rich text format) controls, or even funkier, breaking up your string and dynamically creating text boxes but its major work.

 
JBinQLD

I have it "almost" working.... Just need to know how to work around the "commas". I can get it to bold the words "GTWY" only and "Schd" only with strGTWY... So theres gotta be a way to print in bold only the words that I need...!!! Man - I'm almost there..!!!

Thanks...!!!
air1access
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top