troubleshooting Question

Saving automatically PDF with their default names

Avatar of fitaliano
fitalianoFlag for United States of America asked on
Microsoft OfficeMicrosoft ExcelMicrosoft Access
3 Comments1 Solution201 ViewsLast Modified:
I have the following routine in Excel
Sub PrintMultipleFiles()

   Dim filenames As Variant
   Dim counter As Integer

   ' set the array to a variable and the True is for multi-select
   filenames = Application.GetOpenFilename(, , , , True)

      counter = 1

      ' Ubound determines how many items in the array
      While counter <= UBound(filenames)

         'Opens the selected files
         Workbooks.Open filenames(counter)
         Sheets(Array("DB p1", "DB p2")).Select
         ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
         Sheets("DB p1").Select
         'Close the selected files
         ActiveWorkbook.Close (True)
         'Increment counter
         counter = counter + 1

End Sub

It allows me to select files, automatically open them and print them on pdf if I set my pdf as default printer BUT the only drwback is that I get a popup asking me to save the PDF with the Excel file name.PDF and then it shows the pdf file...

Is there anyway to eliminate the PDF popup asking to save and the subsequent pdf file display?

I basically want the file to be autoamtically saved with whatever name is already assigned to the Excel file.PDF

Thank you

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros