vb 这两个对应代码如何改

来源:百度知道 编辑:UC知道 时间:2024/06/04 05:29:22
这个是保存的
Private Sub Command78_Click()

Dim i As Integer, j As Integer, n As Integer

Screen.MousePointer = vbHourglass

CommonDialog1.Filter = "文本文件(*.txt)"
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
If Dir(CommonDialog1.FileName) <> vbNullString Then
If MsgBox("原文件存在,是否覆盖?", vbYesNo, "提示框") = vbYes Then
Kill CommonDialog1.FileName
Else
Exit Sub
End If
End If

Open CommonDialog1.FileName For Output As #1
For i = 0 To Form9.List1.ListCount - 1
Print #1, Form9.List1.List(n)
Next
Close #1
End If
Screen.MousePointer = vbDefault

End Sub
这个是导入的
Private Sub Command79_Click()
Dim inputdata As String
Dim File As String
Dim S As String
form9.hide
CommonDialog1.Filter = "文本文件(*.txt)"
CommonDialog1.Action = 1
File = CommonDialog1.FileName
If

看你按钮的名称就可以想象你的工程量是多么的大。。。
你是要同步保存和导入吗?
Private Sub Command78_Click()
Dim i As Integer, j As Integer, n As Integer
Screen.MousePointer = vbHourglass

CommonDialog1.Filter = "All Files(*.*)|*.*|Text Files(*.txt)|*.txt"
CommonDialog1.FilterIndex = 2
CommonDialog1.DefaultExt = "txt"
CommonDialog1.ShowSave

If CommonDialog1.FileName <> "" Then
If Dir(CommonDialog1.FileName) <> vbNullString Then
If MsgBox("原文件存在,是否覆盖?", vbYesNo, "提示框") = vbYes Then
Kill CommonDialog1.FileName
Else
Exit Sub
End If
End If
Open CommonDialog1.FileName For Output As #1
For i = 0 To Form9.List1.ListCount - 1
Print #1, Form9.List1.List(i) & " " & Form10.List1.List(i) & " " & Form11.List1.List(i)
Next
Close #1
End If
Screen.MousePointer = vbDefault

End Sub
Private Sub Command79_Click()
Di