-
Manipilating an ASCII string in VBA
Hello
First post on the forum
A dll collection is share between Excel and Multicharts, a charting software. To exchange data between those two application, I'm using a DLL collection call Global Variable.
I got no problem to read and write numeric global variable. The problem occur when manipulating strings.
In Excel, I could read the global Variable, but If I modify it, I got erroneous result. The dll as been written in C++. I read theat C++ is using ASCII with "LSTR" format while Excel is using Unicode with "BSTR" format.
I suspect that this is the cause of the problem
Any idea on how to resolve the problem?
Martin
[VBA]Public Declare Function GV_SetNamedString Lib "C:\Program Files (x86)\TS Support\MultiCharts\GlobalVariable.dll" _
(ByVal strElementLoc As String, ByVal intSetValue As String) As Long
Public Declare Function GV_GetNamedString Lib "C:\Program Files (x86)\TS Support\MultiCharts\GlobalVariable.dll" _
(ByVal strElementLoc As String, ByVal strOther As String) As String[/VBA]
-
Welcome to the forum!
Have you tried StrConv()?
[VBA]
Sub ken()
Dim s As String
s = StrConv("Hello World!", vbFromUnicode)
MsgBox s
s = StrConv("Hello World!", vbUnicode)
MsgBox s
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules