怎样把datagrid的数据放到word/excel里呀

mecgouki 2002-10-04 02:27:35
同上
...全文
71 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tinafang 2002-10-05
  • 打赏
  • 举报
回复
好像不能打印,你可以引用excel对象,再用循环把记录写到excel中去:
dim myapp as excel.application
dim mybook as excel.workbook
dim mysheet as excel.worksheet
dim strdestination as string

on error goto errhandle
strdestination£½app.path & "123.xls"

set myapp=createobject("excel.application")
myapp.visible=false
set mybook=myapp.workbooks.open(strdestination)
set mysheet=mybook.worksheets(1)
mysheet.cells.clear

with mysheet
for i=0 to msh.rows-1
for j=0 to msh.cols-1
.cell(i+1,j+1)=msh.textmatrix(i,j)
next
next
end with
mybook.close true
myapp.quit
mecgouki 2002-10-04
  • 打赏
  • 举报
回复
datagrid 的数据能打印吗
tony_jian 2002-10-04
  • 打赏
  • 举报
回复
www.21code.com里有例子

7,762

社区成员

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

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