Sendkeys not working for print to PDF

jaime79

New Member
Joined
Jul 7, 2009
Messages
4
Hi all,

I'm writing a macro that will run a report in excel, save the excel worksheet and then print it to pdf. Everything works fine except the enter sendkey won't work. Does anyone know a better way then using sendkeys? The macro will run for over 100 accounts so I'd prefer to not have to press "enter" after each one runs. Below is the part of my code that saves & prints to pdf.

Thanks!

ActiveWorkbook.SaveAs (outpth & outname & "_" & tempstring & ".xls")

Application.ActivePrinter = "Adobe PDF on Ne06:"

ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne06:", Collate:=True

SendKeys Filename & "{ENTER}", True

ActiveWorkbook.Close
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,215,463
Messages
6,124,963
Members
449,200
Latest member
indiansth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top