25-09-2006, 05:12 PM
For this to work correctly on Window ME systems, it shoudl be this:
vbNullString causes an error on this line:
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 .
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 FunctionvbNullString 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 .
