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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you use InsertSymbol??? 1

Status
Not open for further replies.

KellyStee

Technical User
Joined
Jul 30, 2001
Messages
106
Location
US
I'm trying to insert a spade, heart, diamond, and club into four separate text boxes. These characters are symbols in the Symbol font, but they don't seem to be associated with any keyboard character. The only way I can see them is to insert them into a document through Microsoft Word (Insert > Symbol). Word references the smybols with character numbers (see below).

Selection.InsertSymbol Font:="Symbol",
CharacterNumber:=-3929, Unicode:= True
Selection.InsertSymbol Font:="Symbol",
CharacterNumber:=-3928, Unicode:= True
Selection.InsertSymbol Font:="Symbol",
CharacterNumber:=-3927, Unicode:= True
Selection.InsertSymbol Font:="Symbol",
CharacterNumber:=-3926, Unicode:= True

Now, I need to be able to use the characters in text boxes for a VB script. Since they are associated with no keystroke (or am I wrong?!?! Are they associated with a keystroke?!?), it seems the only way I can get them to appead in the text box is using code. The only problem is I don't know how to do this.
It seems I would need something like:
on execute
textbox1 = textbox1.InsertSymbol Font:="Symbol",
CharacterNumber:=-3929, Unicode:= True

This doesn't work though. Any ideas??! Please help!!

Thanks!
Kelly

 
Drop a command button and a text box onto a form, then copy and paste in this code, which should illustrate enough for you to forward your project:
[tt]
Private Sub Command1_Click()
Dim lp As Long
Form1.Text1.Font = "Symbol"
For lp = 167 To 170 ' ANSI values of symbols required
Form1.Text1.Text = Form1.Text1.Text + Chr(lp)
Next
End Sub
 
Great!! Thanks SO much!! I got it to work!! I've been working on this all weekend too (I'm rather new to VB).

Kelly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top