Save the document create the object of microsoft word. How to save a microsoft word doc as a pdf click the file tab in the topleft corner of your word screen. I have tried lots of solutions from web and none of the early binding approaches would work for me, kept kicking up errors, that i couldnt solve. Use this selection object to type the text into the worddocument.
View three pieces of content articles, solutions, posts, and videos. Word vba macros saveas pdf or new file name automate. Saving word document as pdf using excel vba stack overflow. Vba code to save word document solutions experts exchange. The first will provide you with the option to change file name and location, the second is a straight export, no questions asked. Microsoft word vba to save document as a pdf in same. Click export in the blue vertical menu that runs along the left side of your screen. Create a selection object with the help of wordobject. How to save a microsoft word doc as a pdf or other file. Filefilter this defines the type of file extension to be filtered throughout the dialog window. The code is written to save your document in the same folder as the excel file currently resides. I recorded a macro in word to save the file as pdf and modified the. If you need to make modifications, hopefully, you will be able to follow along below is a simple vba macro that will allow you to quickly turn your microsoft word document into a pdf file in a snap. Ms word automation vba 6 responses on vba save a word document as a pdf andy bentley june 1, 2018 at 8.
This word macro will save the activedocument with a new file name that includes the current time. Below is a simple vba macro that will allow you to quickly turn your selected worksheet s into a pdf file in a snap. Exportasfixedformat method to save various elements of an excel file as a pdf document. This vba macro will create a new document and save as using the current date and time. The code is written to save your pdf in the same folder as the word document file currently resides.
Vba saveprint a word document as a pdf developers hut. Application create a document object and add documents to it. Sub savewithconverter dim cnvwrdprf as fileconverter look for wordperfect file converter and save document using the converter for the fileformat converter value for each cnvwrdprf in application. This function will also save any word document as a pdf. Excel vba introduction part 41 saving as a pdf youtube. Notice that here the filefilter value is defined as pdf files, which means that the dialog box will only display any files with an extension of. How to save a pdf file with a specific userdefined path. If you need to make modifications, hopefully, you will be able to follow along with my code comments.
1373 934 101 1042 731 21 616 344 909 417 1491 881 1010 183 1202 34 29 1295 864 1298 372 775 1521 1172 367 13 1405 423 1127 39 1478 1493 228 1386 196 1424 1379 286