Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make INI Files Look Appealing Again...
#3
For this to work correctly on Window ME systems, it shoudl be this:

Code:
Public Function GetVar(File As String, Header As String, Var As String) As String
Dim sSpaces As String   ' Max string length

    sSpaces = Space(5000)

    Call GetPrivateProfileString(Header, Var, "", sSpaces, Len(sSpaces), File)

    GetVar = RTrim(sSpaces)
    GetVar = Left(GetVar, Len(GetVar) - 1)
End Function

vbNullString causes an error on this line:
Code:
GetVar = Left$(GetVar, Len(GetVar) - 1)

The only way it work was for me to add the empty string quotes.

Also thought I'd mention that you left out the "Dim sSpaces As String" code, but anyone could figure that out... I'd hope :o .
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)