![]() |
Macro - Feeding path and file name to PDF maker
Hi,
I am using a macro to create a report and the last step is to print a particular worksheet using a PDF maker. I have figured out how to specify the printer as being the PDF maker, but I also want to be able to automatically enter the file name and path, which I will build within the macro depending upon some user inputs. I've built the text strings as I need, I just need to be able to "feed" them to the PDF maker rather than have the dialog box come up and ask the user for that information. Any help? Bill |
Hi Bill,
I stumbled in here today to find the answer to a similar question. I also am creating a macro to automatically print Excel worksheets to pdf. The following is what I have so far in part of my macro: Application.ActivePrinter = "Adobe PDF on Ne00:" If XStr = "X" Then Application.Run AppStr Sheets("SUMMARY").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\" & CoName & ".pdf" Sheets("FLEET").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\" & CoName & "2.pdf" Sheets("SELECT TO PRINT").Select End If It seems to work ok up to a point. The pdf file is created in the selected location, however the file is empty (0 KB) or when opened states it is corrupt. !?! This is what I was looking for help on. Did you get anything to work out? Thanx, Darcy :o) "Bill" wrote: Hi, I am using a macro to create a report and the last step is to print a particular worksheet using a PDF maker. I have figured out how to specify the printer as being the PDF maker, but I also want to be able to automatically enter the file name and path, which I will build within the macro depending upon some user inputs. I've built the text strings as I need, I just need to be able to "feed" them to the PDF maker rather than have the dialog box come up and ask the user for that information. Any help? Bill |
All times are GMT +1. The time now is 07:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com