Unicode character function in VBA & mscorlib.dll


B

bourgui

Hi all,

I am trying to check for certain unicode properties of characters
(such as uppercase, lowercase, alphanumeric, punctuation, symbol
etc...)
The .NET framework has a nice little dll that supposedly offers a
number of functions that do exactly that, mscorlib.dll. The
documentation is here:
http://msdn.microsoft.com/en-us/library/424s1h3z.aspx

So, I am "simply" trying to reference the appropriate functions using
a "Declare" statement such as:
Declare PtrSafe Function IsWhiteSpace Lib "mscorlib" (ByVal char As
Integer) As Boolean

If I run a test routine, like:
Sub test()
If IsWhiteSpace(AscW(Selection.Text)) Then
MsgBox "Is whitespace"
Else
MsgBox "Is not whitespace"
End If
End Sub

I get a runtime error: #53 - File not found; mscorlib.dll

If I try to change the declare method to include the filepath to
mscorlib.dll:
Declare PtrSafe Function IsWhiteSpace Lib "C:\Windows\Microsoft.NET
\Framework64\v4.0.30319\mscorlib.dll" (ByVal char As Integer) As
Boolean

I get a runtime error: #453 - Cannot find DLL entry point IsWhiteSpace
in C\....\mscorlib.dll

If I simply add a reference to mscorlib.dll via "Tools->References", I
get a compile error that the function IsWhiteSpace is not defined.

Can anyone tell me what I'm doing wrong? I know User32.dll offers the
functions "CharrUpper, CharLower and CharAlphaNumurecic, but not the
others that I need for punctuation, whitespace and symbols.

Thanks in advance!
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top