On Error Resume Next
If MSHFlexGrid1.TextMatrix(1, 1) = "" Then
MsgBox "无记录可导出", 0 + vbExclamation, "提示"
Exit Sub
Else
Dim strTemp As String
Dim i As Integer, j As Integer
strTemp = ""
For i = 1 To MSHFlexGrid1.Rows - 1
For j = 1 To MSHFlexGrid1.Cols - 1
strTemp = strTemp & CStr(MSHFlexGrid1.TextMatrix(i, j)) & vbTab
Next j
strTemp = strTemp & vbCrLf
Next i
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|所有文件(*.*)|*.*"
CommonDialog1.ShowSave
filename = CommonDialog1.filename
Open filename For Output As #1
Print #1, strTemp
Close #1
End If
阅读(182) | 评论(0) | 转发(0) |