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. View three pieces of content articles, solutions, posts, and videos. Excel vba introduction part 41 saving as a pdf youtube. Application create a document object and add documents to it. 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. How to save a microsoft word doc as a pdf or other file. 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.
Below is a simple vba macro that will allow you to quickly turn your selected worksheet s into a pdf file in a snap. Save the document create the object of microsoft word. Word vba macros saveas pdf or new file name automate. Microsoft word vba to save document as a pdf in same. Saving word document as pdf using excel vba stack overflow. This function will also save any word document as a pdf. 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.
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. This word macro will save the activedocument with a new file name that includes the current time. Click export in the blue vertical menu that runs along the left side of your screen. How to save a microsoft word doc as a pdf click the file tab in the topleft corner of your word screen. Filefilter this defines the type of file extension to be filtered throughout the dialog window. The code is written to save your pdf in the same folder as the word document file currently resides. Use this selection object to type the text into the worddocument. Create a selection object with the help of wordobject. Vba code to save word document solutions experts exchange.
Vba saveprint a word document as a pdf developers hut. If you need to make modifications, hopefully, you will be able to follow along with my code comments. This vba macro will create a new document and save as using the current date and time. Exportasfixedformat method to save various elements of an excel file as a pdf document. The first will provide you with the option to change file name and location, the second is a straight export, no questions asked.
362 1219 1021 1107 65 574 115 489 77 486 553 1126 1137 421 892 871 424 1301 566 699 676 477 869 1555 1073 204 568 1517 656 395 656 1233 1109 313 845 261 90 219 14 671 1285 408