Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共6 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:表合并错误出在哪里了

1楼
qctv 发表于:2024/4/11 1:36:00

Dim App As New MSExcel.Application

Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\test.xls")
Dim Ws1 As MSExcel.WorkSheet = Wb.WorkSheets("sheet1") '指定要复制的工作表
Dim Ws2 As MSExcel.WorkSheet = Wb.WorkSheets("sheet2")
Dim Ws3 As MSExcel.WorkSheet = Wb.WorkSheets("sheet3")

Ws1.UsedRange.Copy
ws3.Cells(1,1).Select
ws3.paste
Ws2.UsedRange.Copy
'ws3.Cells(1,Ws1.UsedRange.Columns.Count).Select '横向拷贝
ws3.Cells(Ws1.UsedRange.Rows.Count,1).Select '纵向拷贝
ws3.paste

'Wb.Save
app.Visible = True
'App.Quit



.NET Framework 版本:2.0.50727.9174
Foxtable 版本:2018.3.9.1
错误所在事件:窗口,仓管,打印发货单,Click
详细错误信息:
无效索引。 (异常来自 HRESULT:0x8002000B (DISP_E_BADINDEX))


Syscmd.Project.Save()


Dim Book As New XLS.Book(ProjectPath & "Attachments\发货单.xls")
Book.Build() 
Book.Save(ProjectPath & "Reports\发货单.xls")
Dim Proc As New Process
Proc.File = (ProjectPath & "Reports\发货单.xls")
Proc.Start()







Dim App As New MSExcel.Application

Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\发货单.xls")
Dim Ws1 As MSExcel.WorkSheet = Wb.WorkSheets("sheet1") '指定要复制的工作表
Dim Ws2 As MSExcel.WorkSheet = Wb.WorkSheets("sheet2")
Dim Ws3 As MSExcel.WorkSheet = Wb.WorkSheets("sheet3")

Ws1.UsedRange.Copy
ws3.Cells(1,1).Select
ws3.paste
Ws2.UsedRange.Copy
'ws3.Cells(1,Ws1.UsedRange.Columns.Count).Select '横向拷贝
ws3.Cells(Ws1.UsedRange.Rows.Count,1).Select '纵向拷贝
ws3.paste

'Wb.Save
app.Visible = True
'App.Quit
2楼
有点蓝 发表于:2024/4/11 8:47:00
ws3.Cells(Ws1.UsedRange.Rows.Count,1).Select 
改为这种试试
ws3.Cells(ws3.UsedRange.Rows.Count,1).Select 
3楼
qctv 发表于:2024/4/11 9:12:00
不行
4楼
有点蓝 发表于:2024/4/11 9:13:00
请上传实例测试,把这个execl文档发上来测试一下
[此贴子已经被作者于2024/4/11 9:13:27编辑过]
5楼
qctv 发表于:2024/4/11 12:21:00
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:发货单.xls

6楼
有点蓝 发表于:2024/4/11 13:30:00
把生成的报表发过来,不是把模板发过来
共6 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 3 queries.