vb Microsoft common dialog control 6.0 的问题

来源:百度知道 编辑:UC知道 时间:2024/09/21 23:26:56
以下两个代码是保存和导入两个代码
保存:
Private Sub Command46_Click()

Screen.MousePointer = vbHourglass

Dim i As Integer
Dim j As Integer
CommonDialog1.Filter = "CSV File|*.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 200
For j = 0 To 3
Print #1, MSHFlexGrid1.TextMatrix(i, j) & ",";
Next
Print #1, vbNullString
Next
Close #1
End If
Screen.MousePointer = vbDefault
End Sub
打开:
Private Sub Command46_Click()
Dim inputdata As String
CommonDialog1.Action = 1
File = CommonDialog1.FileName
If File = "" Then
MsgBox "没有

'CommonDialog1.FilterIndex = 1

Private Sub Command46_Click()

Screen.MousePointer = vbHourglass

Dim i As Integer
Dim j As Integer
CommonDialog1.Filter = "CSV File|*.txt"
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 200
For j = 0 To 3
Print #1, MSHFlexGrid1.TextMatrix(i, j) & ",";
Next
Print #1, vbNullString
Next
Close #1
End If
Screen.MousePointer = vbDefault
End Sub
打开:
Private Sub Command46_Click()
Dim inputdata As String
CommonDialog1.Action = 1