We help IT Professionals succeed at work.
Get Started

Saving automatically PDF with their default names

Last Modified: 2012-05-11
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
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE