VB 导出到文件中
来源:百度知道 编辑:UC知道 时间:2024/06/25 03:31:51
想把一个窗口中显示的标签及文本的所有内容导出并保存到一个文件中,word或excel最好,txt也行,导出到哪种最方便就用哪种,最好给个简单的例子和必要语句,谢谢!
Private Sub Command1_Click()
Dim c As Control
Open App.Path & "\output.txt" For Output As #1
For Each c In Me.Controls
If TypeOf c Is Label Then Print #1, c.Caption
If TypeOf c Is TextBox Then Print #1, c.Text
Next
Close
End Sub
其实每一种都差不多