PDA

View Full Version : unicode characters from form to .doc



crazyhorse
06-02-2010, 06:35 AM
Hello Im new to VBA and just trying to figure something out...

maybe Ive missed something obvious but I just cant see it...

I have a drop down (word 2003) in a userform indicating a change the values are "up" "down" and "no change"

I have a bookmark on a word doc that it is supposed to replace. Im trying to get a specific arrow to appear but it wont work no matter how I try.

I am trying an if then else if else statement. any help would be appreciated.


Dim strratingchg As String
Dim strup As String
Dim strdown As String

If Nratingchg.Value = "up" Then
strratingchg = strup
ElseIf Nratingchg.Value = "down" Then
strratingchg = strdown
Else: strratingchg = "n/c"
End If
.Bookmarks("Nratingchg").Range.Text = strratingchg


then later on using

TonyJollans
06-02-2010, 07:13 AM
Where, and to what, are you setting the 'specific arrow' characters?

crazyhorse
06-02-2010, 07:26 AM
Where, and to what, are you setting the 'specific arrow' characters?

Hi Tony

uhhhhhhh my edit to the post didnt take...

strup = ChrW(8592)
strdown = ChrW(8593)

I also tried:


strup = Selection.InsertSymbol Font:="Wingdings 3", CharacterNumber:=-3869, _
Unicode:=True

and strdown = Selection.InsertSymbol Font:="Wingdings 3", CharacterNumber:=-3868, _
Unicode:=True

fumei
06-02-2010, 12:55 PM
Do you mean like this? Demo attached. The userform displays on Document_Open, but you can also display it by clicking "Show The Userform" on the top toolbar.

Some comments.

1. perhaps you meant to, but the ChrW you used are incorrect. An UP arrow is 8593; a DOWN is 8595. Your: strup = ChrW(8592) produces a horizontal arrow.

2. you do not need, in fact, the string variables (strup, strdown) at all.
Private Sub cmdDone_Click()
Select Case ComboBox1.Text
Case "Up"
Call FillBM("Nratingchg", ChrW(8593))
Case "Down"
Call FillBM("Nratingchg", ChrW(8595))
Case "No change"
Call FillBM("Nratingchg", "N/C")
Case Else
MsgBox "Huh? You have entered something else."
Exit Sub
End Select
Unload Me
End Sub

crazyhorse
06-03-2010, 06:27 AM
Do you mean like this? Demo attached. The userform displays on Document_Open, but you can also display it by clicking "Show The Userform" on the top toolbar.

Some comments.

1. perhaps you meant to, but the ChrW you used are incorrect. An UP arrow is 8593; a DOWN is 8595. Your: strup = ChrW(8592) produces a horizontal arrow.

2. you do not need, in fact, the string variables (strup, strdown) at all.


dude thx a mil...im gonna just try this now... I had to use the And strdown = Selection.InsertSymbol Font:="Wingdings 3", CharacterNumber:=-3868, _
Unicode:=True but I think this will do juuuuuuuuuuuust fine!

fumei
06-03-2010, 08:57 AM
I had to use the

And strdown = Selection.InsertSymbol Font:="Wingdings 3", CharacterNumber:=-3868, _
Unicode:=True

and just why did you "have to"???

crazyhorse
06-03-2010, 10:21 AM
dunno really... I told my friend Im just using these arrows and done...

crazyhorse
06-04-2010, 11:37 AM
weird your example works perfectly...mine is getting a library error for the ChrW part... any ideas?

fumei
06-04-2010, 01:24 PM
ummm...what library error?