如何调用Excel组件的属性(光交朋友) 在调用前通过代码设置打印属性 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ex1.Range("A2" & ":" & "H10" ).Select '这里开始以下是设置A2到H10表格ex1.Selection.Borders(xlInsideHorizontal).LineStyle = 1ex1.Selection.Borders(xlInsideVertical).LineStyle = 1With ex1.Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomaticEnd WithWith ex1.ActiveSheet.PageSetup .PrintTitleRows = "" .PrintTitleColumns = ""End Withex1.ActiveSheet.PageSetup.PrintArea = "" '这里以下设置打印页面的上.下.左.右边距,打印方向(这里设置为横向),纸张(这里设置为A4纸)With ex1.ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = ex1.Application.InchesToPoints(0.593) .RightMargin = ex1.Application.InchesToPoints(0.393) .TopMargin = ex1.Application.InchesToPoints(0.393) .BottomMargin = ex1.Application.InchesToPoints(0.393) .HeaderMargin = 0.5 .FooterMargin = 0.5 .PrintHeadings = False .PrintGridlines = False .PrintComments = 1 .PrintQuality = 600 .CenterHorizontally = False .CenterVertically = False .Orientation = 2 .Draft = False .PaperSize = vbPRPSA4 .FirstPageNumber = 2 .Order = 2 .BlackAndWhite = False .Zoom = 100 .PrintErrors = xlPrintErrorsDisplayedEnd With 谢谢一楼指点,我已找到答案,我的方法是在Excel2000中定义宏,然后将模块直接在VB中使用,这种方法相对比较简单.如果不会请发贴.我会回.! 急啊!向SQL数据表添已有的记录加字段和数据! 图片的蒙板效果 ADO问题 如何在EXCEL里面点击某一个,在弹出的对话框里列出和这格内容相关的信息 如何在没有硬件环境的条件下调试我的串口通信程序 怎样从已知记录集中得到自己想要的记录? 非常急的问题,请高手帮忙。。。在线等待。。。 為中華軟件業之興起而努力!為討論話題,看誰的話語激昂,得100分 如何向文件连续写纪录 关于模拟键盘消息地问题 关于打印窗体中内容,其中有一个MSFLex控件,还有文本框(所有分都给) 关于绘图的问题
ex1.Selection.Borders(xlInsideHorizontal).LineStyle = 1
ex1.Selection.Borders(xlInsideVertical).LineStyle = 1
With ex1.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With ex1.ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End Withex1.ActiveSheet.PageSetup.PrintArea = "" '这里以下设置打印页面的上.下.左.右边距,打印方向(这里设置为横向),纸张(这里设置为A4纸)
With ex1.ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = ex1.Application.InchesToPoints(0.593)
.RightMargin = ex1.Application.InchesToPoints(0.393)
.TopMargin = ex1.Application.InchesToPoints(0.393)
.BottomMargin = ex1.Application.InchesToPoints(0.393)
.HeaderMargin = 0.5
.FooterMargin = 0.5
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = 1
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = 2
.Draft = False
.PaperSize = vbPRPSA4
.FirstPageNumber = 2
.Order = 2
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With