vba脚本(通过模板和数据表生成多个表)

Attribute VB_Name = "模块"
Sub 由模板生成()
Attribute 由模板生成.VB_ProcData.VB_Invoke_Func = " \n14"
  
    Dim outdir As String
    
    'outdir 输出文件目录
    outdir = "D:\output\"
    If dir(outdir) = "" Then
        MkDir outdir
    End If
     
     
    If Sheets.Count > 2 Then
        For i &
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ppt一页9张最佳打印法,下面是代码 Attribute VB_Name = "NewMacros" Sub PPT最优打印自动排版() Attribute PPT最优打印自动排版.VB_Description = "宏在 2008-6-16 由 欣宇 录制" Attribute PPT最优打印自动排版.VB_ProcData.VB_Invoke_Func = "Normal.NewMacros.Macro1" ' '【调整页边距及页眉页脚距,适用于A4纸】 With ActiveDocument.Styles(wdStyleNormal).Font If .NameFarEast = .NameAscii Then .NameAscii = "" End If .NameFarEast = "" End With With ActiveDocument.PageSetup .LineNumbering.Active = False .Orientation = wdOrientPortrait .TopMargin = CentimetersToPoints(1.6) .BottomMargin = CentimetersToPoints(0.9) .LeftMargin = CentimetersToPoints(1.4) .RightMargin = CentimetersToPoints(1) .Gutter = CentimetersToPoints(0) .HeaderDistance = CentimetersToPoints(0.5) .FooterDistance = CentimetersToPoints(0.9) .PageWidth = CentimetersToPoints(21) .PageHeight = CentimetersToPoints(29.7) .FirstPageTray = wdPrinterDefaultBin .OtherPagesTray = wdPrinterDefaultBin .SectionStart = wdSectionNewPage .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False .VerticalAlignment = wdAlignVerticalTop .SuppressEndnotes = False .MirrorMargins = False .TwoPagesOnOne = False .BookFoldPrinting = False .BookFoldRevPrinting = False .BookFoldPrintingSheets = 1 .GutterPos = wdGutterPosLeft .LayoutMode = wdLayoutModeLineGrid End With '【加页码,页脚居中处】 Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _ wdAlignPageNumberCenter, FirstPage:=True If ActiveWindow.View.SplitSpecial <> wdPaneNone Then ActiveWindow.Panes(2).Close End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then ActiveWindow.ActivePane.View.Type = wdPrintView End If ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader If Selection.HeaderFooter.IsHeader = True Then ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Else ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then If ActiveWindow.Panes.Count = 2 Then ActiveWindow.Panes(2).Close End If ActiveWindow.View.SplitSpecial = wdPaneCurrentPageHeader Else ActiveWindow.View.SeekView = wdSeekCurrentPageHeader End If ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument ActiveWindow.ActivePane.VerticalPercentScrolled = 0 '【调整每张幻灯片的大小为高184宽262,也许还有更佳的值,可自己尝试】 Dim i As Integer For i = 1 To ActiveDocument.InlineShapes.Count ActiveDocument.InlineShapes(i).Height = 184 ActiveDocument.InlineShapes(i).Width = 262 Next i '【给每张幻灯片加边框,感觉没有边框很难看】 Selection.HomeKey Unit:=wdStory Dim j As Integer For j = 1 To ActiveDocument.InlineShapes.Count Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend With Selection.InlineShapes(1) With .Borders(wdBorderLeft) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderRight) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderTop) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With .Borders.Shadow = False End With With Options .DefaultBorderLineStyle = wdLineStyleSingle .DefaultBorderLineWidth = wdLineWidth050pt .DefaultBorderColor = wdColorAutomatic End With Selection.MoveRight Unit:=wdCharacter, Count:=1 Next j End Sub

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值