将MsFlexGrid控件的内容输出到文本

2008-02-23 07:04:18来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

'OutDataToText
'将MsFlexGrid控件中显示的内容输出到文本文件
Public Sub OutDataToText(Flex As MSFlexGrid)
Dim s As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim strTemp As String
On Error GoTo Ert
Me.MousePointer = 11
On Error Resume Next
DoEvents
Dim FileNum As Integer
FileNum = FreeFile
Open "d:\aa.txt" For Output As #FileNum
With Flex
k = .Rows
For i = 0 To k - 1
strTemp = ""
For j = 0 To .Cols - 1
DoEvents
strTemp = strTemp & .TextMatrix(i, j) & ","
Next j
Print #FileNum, Left(strTemp, Len(strTemp) - 1)
Next i
End With
Close #FileNum
Me.MousePointer = 0
MsgBox "导出成功"
Ert:
MsgBox Err.Description
Me.MousePointer = 0
End Sub



上一篇: VB学习:文本插入与编辑处理实例
下一篇: 用VB和Word来制作格式合同的方法

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Visual Basic下工具条的制作之二

下一篇:VB.NET面向对象的实现(1)创建类