|
|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub ykcbf() '//2025.11.8 批量转PDF文件
- With Application
- .ScreenUpdating = False
- .DisplayAlerts = False
- .Calculation = xlCalculationManual
- .AskToUpdateLinks = False '//禁用更新提示
- .EnableEvents = False
- End With
- Set fso = CreateObject("scripting.filesystemobject")
- p = ThisWorkbook.Path & Application.PathSeparator
- Dim tm: tm = Timer
- xm = Array("出库单B-C", "入库单B-C", "货物收据B-C", "货权转移凭证B-C", "结算确认单B-C2份")
- b = Array("出库", "入库", "货收", "货转", "结算")
- On Error Resume Next
- For Each fd In fso.GetFolder(p).SubFolders
- For Each f In fso.GetFolder(fd).Files
- fn = fso.GetBaseName(f)
- Set wb = Workbooks.Open(f.Path, 0, True, , False)
- For x = 0 To UBound(xm)
- wb.Sheets(xm(x)).ExportAsFixedFormat _
- Type:=xlTypePDF, _
- Filename:=p & fn & "--燕华" & b(x) & ".pdf", _
- Quality:=xlQualityStandard, _
- IncludeDocProperties:=True, _
- IgnorePrintAreas:=False, _
- From:=1, To:=1, _
- OpenAfterPublish:=False
- Next
- wb.Close False
- Next f
- Next
- On Error GoTo 0
- With Application
- .DisplayAlerts = True
- .ScreenUpdating = True
- .Calculation = xlCalculationAutomatic
- .AskToUpdateLinks = True
- .EnableEvents = True
- End With
- MsgBox "共用时:" & Format(Timer - tm, "0.000") & "秒!"
- End Sub
复制代码
|
|