Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-23-2014, 11:41 AM
mbesspiata mbesspiata is offline Open and save Word files Windows 7 64bit Open and save Word files Office 2010 64bit
Advanced Beginner
Open and save Word files
 
Join Date: Mar 2011
Location: Virginia
Posts: 57
mbesspiata is on a distinguished road
Default Open and save Word files

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open and save Word files VBA to open files in Word Lu_Argentina Word VBA 5 02-22-2022 02:41 PM
Open and save Word files Save Word Files as OLE Bound Objects 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
Open and save Word files Word 2007 won't let me open or save documents! iteach Word 10 11-25-2011 12:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft