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 KeyValue = WorksheetFunction.Clean(Trim(KeyValue)) Else KeyValue = "" End If GetIni = KeyValue End Function
标签:Function,VBA,String,ByVal,KeyValue,ini,Integer,读取 From: https://www.cnblogs.com/sonycat/p/sonycat_GetIni.html