如何在外部的txt的第二行输入值?
Open App.Path & "\out5.txt" For Output As #1
print #1, text1.text
Close #1
用上面的方法只能在第一行输入 如何在第二行输入呢,如果方便的话也请告诉我如何调用第二行的值?
帮你找到一个获取文本行数的函数
如果要再任意行插入估计还要利用到其他API函数了!
Const WM_USER = &H400
Const EM_GETLINECOUNT = WM_USER + 10
#If Win32 Then
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
lParam As Any) As Long
#Else
Private Declare Function SendMessage Lib "user" _
(ByVal hWnd As Integer, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
lParam As Any) As Long
#End If
Function TextLineCount(txtObj As TextBox) As Long
If txtObj.MultiLine = True Then
TextLineCount = SendMessage(txtObj.hWnd, EM_GETLINECOUNT, 0, 0&)
Else
TextLineCount = 1
End If
End Function