zoukankan      html  css  js  c++  java
  • VBA之EXCEL打印

    活动工作表打印

    Sub Print()

           ActiveSheet.PrintOut

    End Sub

     

    设置页面

    Sub PrintSh()

           With WorkSheets(“Sheet1”)

           设置打印方向

                  .PageSetup.Orienttation=xlLandscape

           End With

    End Sub

     

    设置第一张工作表的所有页边距

    Sub SetPage()

           With Worksheets(1).PageSetup

                  .LeftMargin=Application.InchesToPoints(0.5)

                  .RightMargin=Application.InchesToPoints(0.75)

                  .TopMargin= Application.InchesToPoints(1.5)

    .BottomMargin= Application.InchesToPoints(1)

    .HeaderMargin= Application.InchesToPoints(0.5)

    .FooterMargin= Application.InchesToPoints(0.5)

           End With

    End Sub

     

    页眉折行打印

    Sub Printer()

           ActiveSheet.PageSetup.CenterHeader=”&””Arial,Bold Italic””&14 期末成绩表” _

                  & Chr(13) & Sheets(2).Range(“A1”)

           打印预览

           ActiveWindow.SelectedSheets.PrintPreview

    ActiveWindow.SelectedSheets.PrintOut Copies:=1   打印一份文件

    End Sub

     

    为工作簿中每个工作表进行设置,设置打印为1-3

    Sub Top3LinesPrint()

           Dim wkSheet as WorkSheet

           For Each wkSheet In Application.Worksheets

                  With wkSheet.PageSetup

                         .PrintTitleRows=”$1:$3”

                  End With

                  Sheets(wkSheet.Name).Rows(“1:3”).Font.Bold=True

           Next wkSheet

    End Sub

     

    设置工作表标签颜色

    ActiveSheet.Tab.ColorIndex=6

  • 相关阅读:
    【转】shell中的内建命令, 函数和外部命令
    clear out all variables without closing terminal
    linux中shell命令test用法和举例
    解决vim粘贴时格式混乱的问题
    scp的两种方式
    source 命令的用法,是在当前bash环境下执行脚本文件
    angularjs中下拉框select option默认值
    redux 及 相关插件 项目实战
    JavaScript 获取当前时间戳
    v-if v-else-if v-else
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2121453.html
Copyright © 2011-2022 走看看