首页 > 编程语言 > 详细

VBA读写ini 配置文件

时间:2019-03-30 10:27:37      阅读:435      评论:0      收藏:0      [点我收藏+]
Option Explicit
   ‘read
   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 Long, _
                   ByVal lpFileName As String) As Long
   ‘write
   Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
                 (ByVal lpApplicationName As String, _
                   ByVal lpKeyName As String, _
                   ByVal lpString As String, _
                   ByVal lpFileName As String) As Long

Sub Read()
    Dim Rec As String
    Dim NC As Long
    
    Rec = String(255, 0)
    NC = GetPrivateProfileString("BOOT", "Shell", "", Rec, 255, "D:\test.ini")
    MsgBox Rec
    
End Sub

Sub WriteProfile()
    Dim NC As Long
    NC = WritePrivateProfileString("BOOT", "Shell", "Test1", "D:\test.ini")
End Sub

  

VBA读写ini 配置文件

原文:https://www.cnblogs.com/luoye00/p/10625222.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!