mcelhany
asked on
Send Enter to "Save PDF File AS"form
This is what I'm running: Access 2003 PS2, Windows XP Professional 2002
I have established a PDF printer as my default and am trying to save a report as a PDF document.
I'm using code to open a report and saving it to a PDF.
DoCmd.OpenReport Fname_1, acNormal
This works okay, it brings up the "Save" form and is waiting for an {Enter}.
I want to automate the process and have code pass an {Enter} to the "Save PDF File As" form.
I've tried every combination of Sendkeys that I can come up with. One Expert spoke of an option for the "OpenReport" ; sfilter. Couldn't get this to work either.
I'm hoping that since the printer is my system default that there is some way to pass a key stroke to the form.
Thanks
Form.doc
I have established a PDF printer as my default and am trying to save a report as a PDF document.
I'm using code to open a report and saving it to a PDF.
DoCmd.OpenReport Fname_1, acNormal
This works okay, it brings up the "Save" form and is waiting for an {Enter}.
I want to automate the process and have code pass an {Enter} to the "Save PDF File As" form.
I've tried every combination of Sendkeys that I can come up with. One Expert spoke of an option for the "OpenReport" ; sfilter. Couldn't get this to work either.
I'm hoping that since the printer is my system default that there is some way to pass a key stroke to the form.
Thanks
Form.doc
ASKER
I've tried Sendkeys "{Enter]" and Sendkeys "{~}". I've added a line before the print command, DoCmd.SetWarnings False.
Still can't get the form to acknowledge the code.
Still can't get the form to acknowledge the code.
You probably need to put it before the Print command and the ~ doesn't need anything around it, you may want to add the WAIT parameter to true
Cheers, Andrew
Cheers, Andrew
Please advise what you are using to create the PDF.
Also, what version of Access are you using?
Cheers, Andrew
Also, what version of Access are you using?
Cheers, Andrew
ASKER
This is what I'm running: Access 2003 PS2, Windows XP Professional 2002
The PDF is being created by a driver loaded to the system. It's called Print2PDF.
I've tried: SendKeys "{Enter}", True ; SendKeys "{Enter}", False ; SendKeys "~"
The PDF is being created by a driver loaded to the system. It's called Print2PDF.
I've tried: SendKeys "{Enter}", True ; SendKeys "{Enter}", False ; SendKeys "~"
This is not one I am familiar with, looking at the website there is a download that will do what you are after but is UD$29.95. This is downloadable at http://www.ab-archive.com/programs/applications/print_programs_and_tools/vb_vba_code_printer_system.html
Personally I have used code with PDF995, CutePDF and Adobe's own printer dirver.
Cheers, Andrew
Personally I have used code with PDF995, CutePDF and Adobe's own printer dirver.
Cheers, Andrew
ASKER
Still looking for an answer!
Can you confirm that the default button is the Save option, also, have you tried ALT-S, in sendkeys it is %s
Cheers, Andrew
Cheers, Andrew
ASKER
I did check that out. The first field is the name. The "Save" is activeated by: Enter and Alt S and 2 Tabs followed by an Enter.
For the Alt, I'm using the syntax: Sendkeys "% S". Is this correct?
For the Alt, I'm using the syntax: Sendkeys "% S". Is this correct?
There is no space between %S. Cheers, Andrew
ASKER
I keep trying, but Access isn't playing very well. I got the Alt S corrected and am wondering ... could there be an "Options" setting that is prohibiting the code from being transferred? Sems like it should be pretty straight forward to send a key stroke to a printer popup.
Hey, Thanks for the help Andrew! If you think of anything else, I'm willing to try.
Hey, Thanks for the help Andrew! If you think of anything else, I'm willing to try.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, I'll give it a look tomorrow.
ASKER
Hello Andrew,
I was not able to get the Sendkeys to work. But, your link to the documentation lead me to a parameter that disables the "As as ..." dialog box. With a little more work, I should be able to accomplish my task. Thanks for sticking with me.
PAtrick
I was not able to get the Sendkeys to work. But, your link to the documentation lead me to a parameter that disables the "As as ..." dialog box. With a little more work, I should be able to accomplish my task. Thanks for sticking with me.
PAtrick
No problem and good luck. Andrew
Failing that then it depends on what you are using to create the PDF file as there are code to do this but it is software specific.
Cheers, Andrew