vb中输出到excel后如何控制页面边距?

windata 2002-10-28 01:33:09
Set zsbexcel = New Excel.Application
zsbexcel.Visible = True
zsbexcel.SheetsInNewWorkbook = 1
Set zsbworkbook = zsbexcel.Workbooks.Add

zsbexcel.ActiveSheet.Rows.HorizontalAlignment = xlVAlignCenter '水平居中

zsbexcel.ActiveSheet.Rows.VerticalAlignment = xlVAlignCenter '垂直居中
----------------------------------------------------
以上是控制对齐方式,请问如何控制边距?比如将左右边距改为0.5?
...全文
61 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
windata 2002-10-29
  • 打赏
  • 举报
回复
下头的两位不好意思,我结贴了以后才发现你们的,呵呵,不过还是很感谢各位的帮助!
shalen520 2002-10-29
  • 打赏
  • 举报
回复
写错了,应该是margin
shalen520 2002-10-29
  • 打赏
  • 举报
回复

WITH Excelapp.activesheet.pagesetup
顶边距2CM:
.topmarign=2/0.035
左边距2CM:
.leftmarign=2/0.035
右边距2CM:
.rightmarign=2/0.035
底边距2CM:
.bottommarign=2/0.035


iceriver521 2002-10-29
  • 打赏
  • 举报
回复
录制宏!
pei_yanni 2002-10-29
  • 打赏
  • 举报
回复
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.196850393700787)
.RightMargin = Application.InchesToPoints(0.196850393700787)
.TopMargin = Application.InchesToPoints(0.984251968503937)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 180
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA3
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With

809

社区成员

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

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