fitaliano
asked on
Saving automatically PDF with their default names
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.GetOpenFilenam e(, , , , 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.SelectedSheet s.PrintOut Copies:=1, Collate:=True
Sheets("DB p1").Select
'Close the selected files
ActiveWorkbook.Close (True)
'Increment counter
counter = counter + 1
Wend
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
__________________________
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.GetOpenFilenam
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.SelectedSheet
Sheets("DB p1").Select
'Close the selected files
ActiveWorkbook.Close (True)
'Increment counter
counter = counter + 1
Wend
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I figured out the solution by myself
What version of office are you using? Later versions allow you to save as pdf. I know you can with A2010, with A2007 you need the SaveAsPDF addon. I have used it in Access but I assume the same would work with Excel.