armylee 发表于 2005-4-29 00:31:00

[VBA]数据结构怎样输出?

怎样把vba中的数据结构,在运行之后以文本(.txt)的形式输出?


请教一下应该怎样编程。

雪山飞狐_lzh 发表于 2005-4-29 20:39:00

做个函数呀


Private Type TA<BR>                       a As Double<BR>                       b As Integer<BR>End Type<BR>Function OutPutTA(a As TA)<BR>OutPutTA = a.a + "," + a.b<BR>End Function<BR>

armylee 发表于 2005-4-29 21:03:00

output是一个输出函数吗?


我得要求是运行后得到一个.txt文件,里面是TA的数据。

雪山飞狐_lzh 发表于 2005-4-29 21:23:00

Private Type TA<BR>                       a As Double<BR>                       b As Integer<BR>End Type<BR>Function OutPutTA(a As TA)<BR>OutPutTA = a.a &amp; "," &amp; a.b<BR>End Function<BR>Sub TT()<BR>Dim fso As Object<BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>Dim ts As Object<BR>Set ts = fso.OpenTextFile("c:\1.txt", ForAppending, True)<BR>Dim a As TA<BR>a.a = 1


ts.WriteLine OutPutTA(a)<BR>End Sub

armylee 发表于 2005-4-29 23:08:00

Private Type TA<BR>                       a As Double<BR>                       b As Integer<BR>End Type<BR>function OutPutTA(a As TA)<BR>OutPutTA = a.a &amp; "," &amp; a.b<BR>End Function<BR>Sub TT()<BR>Dim fso As Object<BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>Dim ts As Object<BR>Set ts = fso.OpenTextFile("c:\1.txt", ForAppending, True)


                                                                                                                                                                                                                               ~~~~~~~~~~~~~~~~~~无效的过程或函数调用<BR>Dim a As TA<BR>a.a = 1





ts.WriteLine OutPutTA(a)<BR>End Sub
页: [1]
查看完整版本: [VBA]数据结构怎样输出?