Changing character set VBA (1 Viewer)

Eikenhorst

Registered User.
Local time
Today, 16:59
Joined
Mar 9, 2007
Messages
25
I wanted to do something very simple in VBA, to change the caption of a label so it shows some values loaded from a table.

The code should be:
Me.Label1.Caption = “Check if value is ≤ “& rst!Value< & “ and ≥ “ & rst!Value>

This gives me two problems. First VBA doesn’t know the ≥ and ≤ symbols since those are Unicode symbols only. But I do want to use those symbols instead of <= that would be clear to a programmer like me, but the users of this program would hardly understand that that means the same. So is there a way I can let VBA accept Unicode symbols?

Secondly, the name of the table row has an < at the end. If I use this name like this it thinks that it will be followed by something else to compare with. It isn’t handy this way, but for me it isn’t possible to change the row names, so any help would be greatly appreciated!

Thanks
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 15:59
Joined
Sep 12, 2006
Messages
15,662
not sure about the unicode

try wrapping the field name in square brackets

rst![value>] - that might work, but im not sure - you ought to be able to do it somehow, if its a legal character in a field definition.
 

Noel

Registered User.
Local time
Today, 07:59
Joined
Apr 13, 2007
Messages
61
the ascii character codes are as follows:
≤=2264
≥=2265, I thought you could use them like chrw(2265) or chr(2265), but its not returning the right characters.

Sorry
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:59
Joined
Feb 28, 2001
Messages
27,232
Unless the item in question is set up to display in a UNICODE font, inserting a UNICODE character does no good.

Also, look at the definition for CHR$(), which I think ONLY works on byte values. And CHR$(2265) surely isn't a byte. CHRW$() should work in a UNICODE setting.
 

Eikenhorst

Registered User.
Local time
Today, 16:59
Joined
Mar 9, 2007
Messages
25
Hello, thanks for your reactions!

I wasn't online this weekend so I couldn't reply until now. First of all, thanks Gemma your sugestion worked, so stupid of me not to think of that :(

About the unicode character, Noel was right; ChrW(2265) should work fine, but the fact is that it doesn't it returns a squere. I have set the Numeral Shapes setting to Context, but that doesn't give the right result.

I found the following on the Microsoft site:
"ChrW takes CharCode as a Unicode code point. The range is independent of the culture and code page settings for the current thread. Values from -32768 through -1 are treated the same as values in the range +32768 through +65535."

I still hope someone can give me a good solution. Thanks!
 

Eikenhorst

Registered User.
Local time
Today, 16:59
Joined
Mar 9, 2007
Messages
25
Thinking of a posible solution. Is it someway posible to change just a part of the text of a Label. Because if I don't work with VBA I can show the right characters. So if I could just leave those and just change the values with VBA that would be a solution.

I just don't have an idea if this is posible. But it was just an idea, maybe someone else can work with it?
 

Eikenhorst

Registered User.
Local time
Today, 16:59
Joined
Mar 9, 2007
Messages
25
Thanks everybody for pointing me at the ChrW() function (VBA help doesn't know it for instance).

I have found the solution why ChrW(2265) doesn't works. When I tried to import this symbol in Word I saw that it was a Heximal number. So 2265 is actualy 8805. And gues what ChrW(8805) works fine.

So thanks everybody, problem solved! :D
 

saintsman

Registered User.
Local time
Today, 15:59
Joined
Oct 12, 2001
Messages
138
This has been very helpful, however the code that I need is 25B2 ( for a ▲).

It doesn't seem to like the B2 part for some reason. Numbers on their own is fine.

Any suggestions appreciated.
 

neileg

AWF VIP
Local time
Today, 15:59
Joined
Dec 4, 2002
Messages
5,975
As Eikenhorst implies, try changing the hexadecimal 25B2 to the decimal equivalent 9650.
 

saintsman

Registered User.
Local time
Today, 15:59
Joined
Oct 12, 2001
Messages
138
Yes thats it.

I got confused when I couldn't find the numbers on the 'insert symbols' drop down in word and because its been years since I did hexidecimal and didn't recognise what I was seeing.

Thank you.
 

Users who are viewing this thread

Top Bottom