Consulting

Results 1 to 2 of 2

Thread: Manipilating an ASCII string in VBA

  1. #1
    VBAX Newbie
    Joined
    Jul 2013
    Posts
    1
    Location

    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]

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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
  •