text1.text 文本框的内容,保存成EXCEL文件.

NTYYBX 2002-10-15 08:47:18
text1.text 文本框的内容,保存成EXCEL文件.谢谢!
...全文
75 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
daichao1251712 2002-10-15
  • 打赏
  • 举报
回复
我想可能还有格式的问题吧
要不用RICHTEXT试试
================================================================
horse has four leg
so water in sea

junwhj 2002-10-15
  • 打赏
  • 举报
回复
Option Explicit

'---------------------------------------------
'要先引用Microsoft Excel x.x Object Library
'---------------------------------------------

Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As New Excel.Worksheet
Dim strFile As String

strFile = "c:\test.xls"

Screen.MousePointer = 11

Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets("Sheet1")

xlSheet.Cells(1, 1) = Text1.Text
xlSheet.SaveAs strFile

Set xlSheet = Nothing

xlBook.Close
Set xlBook = Nothing

xlApp.QUIT
Set xlApp = Nothing

Screen.MousePointer = 0

MsgBox "OK", vbExclamation
End Sub
llfz 2002-10-15
  • 打赏
  • 举报
回复
可以先按规范格式保存为文本文件*.txt,再将其转换为excel文件

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧