我们将文档导出到前面演示相同的位置,格式为PDF,书签参数选择上图中的第1种 Sub导出PDF_根据Word标题创建书签()ActiveDocument.ExportAsFixedFormat2outputfilename:="E:\Zhuomian_CJ\Test01.PDF",_ExportFormat:=wdExportFormatPDF,createBookMarks:=wdExportCreateHeadingBookmarksEndSub 我们看看生成的PDF文件 Word标题生成...
"p" ws.PageSetup.Orientation = xlPortrait End Select ws.PageSetup.FitToPagesWide = 1 ws.PageSetup.FitToPagesTall = False ws.PageSetup.RightFooter = "Page &P of &N" End With NextSheet: Next sFile = Application.GetSaveAsFilen...
SubPPT打印PDF(prs As Presentation,fName As String)With prs.PrintOptions.Collate=msoTrue.FitToPage=msoTrue.FrameSlides=msoCTrue '加边框 '.OutputType=ppPrintOutputSixSlideHandouts.OutputType=ppPrintOutputSlides.PrintColorType=ppPrintColor End With prs.PrintOut printtofile:fName End Sub SubPPT导出PDF(prs...
在该工作簿的工程资源管理器中单击右键,选择导入文件,再将模块导入。
使用VBA打印到PDF现有宏是一种将文件以PDF格式保存的操作。 VBA中可以利用内置的SaveAs方法,将现有的文档保存为PDF格式。以下是一个示例VBA代码: 代码语言:txt 复制 Sub PrintToPDF() ' 定义文件路径和名称 Dim filePath As String filePath = "C:\Path\To\Save\Your\File.pdf" ' 打印文档到PDF ActiveSheet...
myFile As Object Dim 后缀 As String Dim t0 As Single Dim 书签类型 AsLongt0=Timeri=0:j=0:m=0Setfd=Application.FileDialog(msoFileDialogFolderPicker)Setfso=CreateObject("Scripting.FileSystemObject")With fd.Title="选择主文件夹"If.ShowTheni=i+1ReDimPreservecrr(1Toi)crr(i)...
With ActiveSheet.PageSetup .PrintArea="$A$1:$H$"&Simple_LastRowOnPage End With ' Exporttheactive sheetasPDF ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF,Filename:=PDFPath,Quality:=xlQualityStandard,IncludeDocProperties:=True,IgnorePrintAreas:=False ...
Private Sub CmdUp_Click() With Me.CmbMonth For i = 0 To .ListCount - 1 If .Text = .List(i) Then j = i Exit For End If Next If j = 0 Then .Text = .List(.ListCount - 1) Else .Text = .List(j - 1) End If End With Me.CmdSe...
xFileName, xIndex - 1) ' Exception handling with continue on error strategy On Error Resume Next Set objWordDoc = Documents.Open(Filename:=xFolder & xFileName, _ ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _ PasswordDocument:="", PasswordTemplate...
.PrintTitleRows = ActiveSheet.Rows(1).Address .Zoom = False .FitToPagesTall = False .FitToPagesWide = 1 End With ActiveSheet.ExportAsFixedFormat _Type:=xlTypePDF, _Filename:="myPDF", _Quality:=xlQualityStandard, _IncludeDocProperties:=False, _IgnorePrintAreas:=False, _From:=1, To:=5, ...