明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1334|回复: 4

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

[复制链接]
发表于 2005-4-29 00:31:00 | 显示全部楼层 |阅读模式
怎样把vba中的数据结构,在运行之后以文本(.txt)的形式输出?


请教一下应该怎样编程。
发表于 2005-4-29 20:39:00 | 显示全部楼层
做个函数呀 Private Type TA
a As Double
b As Integer
End Type
Function OutPutTA(a As TA)
OutPutTA = a.a + "," + a.b
End Function
 楼主| 发表于 2005-4-29 21:03:00 | 显示全部楼层
output是一个输出函数吗?


我得要求是运行后得到一个.txt文件,里面是TA的数据。
发表于 2005-4-29 21:23:00 | 显示全部楼层
Private Type TA
a As Double
b As Integer
End Type
Function OutPutTA(a As TA)
OutPutTA = a.a & "," & a.b
End Function
Sub TT()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ts As Object
Set ts = fso.OpenTextFile("c:\1.txt", ForAppending, True)
Dim a As TA
a.a = 1 ts.WriteLine OutPutTA(a)
End Sub
 楼主| 发表于 2005-4-29 23:08:00 | 显示全部楼层
Private Type TA
a As Double
b As Integer
End Type
function OutPutTA(a As TA)
OutPutTA = a.a & "," & a.b
End Function
Sub TT()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ts As Object
Set ts = fso.OpenTextFile("c:\1.txt", ForAppending, True) ~~~~~~~~~~~~~~~~~~无效的过程或函数调用
Dim a As TA
a.a = 1 ts.WriteLine OutPutTA(a)
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 17:39 , Processed in 0.181024 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表