![]() |
#1
|
|||
|
|||
![]()
I have a macro to format a text file and I want to save it as a pdf file when formatted. I want a macro to do the opening of the text file and the saving as a pdf file. I recorded these operations but I need to know how to input code so that the file name is not specific. I want it to ask me what file to open and what the file name should be when formatting to pdf. Here is what I recorded.
Macro1 Macro ' ' ActiveDocument.ExportAsFixedFormat OutputFileName:= _ "C:\Users\mbesspiata\Desktop\Dayton Countsheet File.pdf", ExportFormat:= _ wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _ wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _ Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ BitmapMissingFonts:=True, UseISO19005_1:=False ChangeFileOpenDirectory "C:\Users\mbesspiata\Desktop\" Windows("Document1").Activate ActiveWindow.Close End Sub Sub Macro2() ' ' Macro2 Macro ' ' ChangeFileOpenDirectory "C:\Users\mbesspiata\Desktop\" Documents.Open FileName:="Dayton Countsheet File.txt", ConfirmConversions _ :=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _ PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _ WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:="", _ Encoding:=1252 End Sub Mike |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Lu_Argentina | Word VBA | 5 | 02-22-2022 02:41 PM |
![]() |
KSReynolds | Word VBA | 1 | 12-18-2013 05:51 PM |
Can't save Large Word files to html | Gardener | Word | 0 | 12-25-2011 09:37 AM |
Word wont save when Outlook is open. | erik2282 | Office | 0 | 11-26-2011 08:00 AM |
![]() |
iteach | Word | 10 | 11-25-2011 12:23 PM |