Vba code to print a pdf file
I have an Access Form with comboboxes that allows a user to select different information. I have a free software called PDFLite and installs on my computer as a printer. Worksheets "Rental".
Range "A1:N24". ExportAsFixedFormat … Reviews: 5. Use the following code in your macro to save your file as PDF. Here is more information. For the past few years I've used Office , and with it, a particular VBA for Excel script which would print a worksheet to PDF, while scaling to fit all columns to a single page wide.
DoEvents Loop Until …. Toggle navigation Websiteperu. Home Extension Country Pricing. Thanks for the reply. I already will have a PDF File in a specific folder. I have them enter the name of the file and folder location in a field and the macro I want looks for the PDF file with that location and file name and prints it. Is this possible? I just reread your original post..
I am sorry - I must have been asleep! I kept reading "print TO pdf" - which would be saving as pdf used to be a Print option in Excel and still is for some programs. Also, the call is bit, so won't work in bit Excel Code:. Almost got my program to work the way I want, but am having issues calling a function from my userform.
When the Excel file is opened I have a userform automatically pulled up. Two text boxes are filled in, one for folder path and one for file name. Some files will be word, excel, pdf. I want the same concept as in my userform to work with the function. Any help would be great. Thanks Here is my userform code its a bit long and messy, but it works Code:. PrintOut objWord. Worksheets strWorksheetName ExcelSheet.
PrintOut ExcelApp. There is no advantage to declaring them scattered throughout your code.. I don't see anything in your userform code trying to print the PDF, so I can't correct what you were trying to do You can just put a call in your userform to PrintPDF and send it the arguments.
VBA Code:. If Err. Add a comment. Active Oldest Votes. Call apiShellExecute Application. Improve this answer. June7 I know this is from a while ago but I'm getting an error when using this saying printer information not found. I've tried typing the printer name in multiple times and was wondering how the printer name is supposed to look. Is it the IP?
This printer is on a network with multiple computer connections if that changes anything. You should look at the printer name on windows control panel. There is the name of each printer, right the same you must use here, at least so worked for me. I tested it. Sleep 'wait 1 sec file. Teamothy 1, 3 3 gold badges 13 13 silver badges 19 19 bronze badges.
Kajkrow Kajkrow 1 1 silver badge 13 13 bronze badges. Hi Kajkrow, Thank you for your help. However, Im so sorry.
0コメント