Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer

Function GetIni(KeyStr As String, Wat As String, ByVal Fil As String) As String
    Dim n As Integer
    Dim KeyValue As String
    KeyValue = Space(255)
    n = GetPrivateProfileString(KeyStr, Wat, "", KeyValue, 255, Fil)
    If n > 0 Then
        GetIni = WorksheetFunction.Clean(Trim(KeyValue))
    Else
        GetIni= ""
    End If
End Function

 

posted on 2023-10-07 17:25  sonycat  阅读(105)  评论(0编辑  收藏  举报