以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]exec模板打印怎么自定义纸张大小?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126693)

--  作者:mxko
--  发布时间:2018/10/26 15:26:00
--  [求助]exec模板打印怎么自定义纸张大小?

如题,现在代码如下,求大侠帮忙修改:

Dim Book As New XLS.Book(ProjectPath & "Attachments\\地磅单.xls")
Dim fl As String
fl = ProjectPath & "Reports\\地磅单.xls"
Dim sql2 As String
sql2 = "查询语句"
book.AddDataTable("B","GM",sql2)
Book.Build()
Book.Save(fl)

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
App.Caption = "地磅单"
App.PrintCommunication = False
With Ws.PageSetup
.CenterHorizontally = True \'页面水平居中
End With
App.PrintCommunication = True
App.Visible = True
Wb.Save()

Wb.Close()
Ws.PrintPreview(True)

App.Quit
MessageBox.Show("打印完成!","提示")


--  作者:有点蓝
--  发布时间:2018/10/26 15:49:00
--  
.PaperSize = MSExcel.XlPaperSize.xlPaperA4   \'纸张大小


--  作者:mxko
--  发布时间:2018/10/26 17:39:00
--  

.PaperSize = MSExcel.XlPaperSize.xlPaperA4   \'纸张大小

这个没法设置 宽:216mm 高:138mm

大小的纸


--  作者:有点蓝
--  发布时间:2018/10/26 20:22:00
--  

参考

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=54472&skin=0