Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

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
0
mcelhany
Asked:
mcelhany
  • 8
  • 7
1 Solution
 
TextReportCommented:
Have your tried the ~ in the sendkeys command.

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
0
 
mcelhanyAuthor Commented:
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.
0
 
TextReportCommented:
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
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
TextReportCommented:
Please advise what you are using to create the PDF.
Also, what version of Access are you using?
Cheers, Andrew
0
 
mcelhanyAuthor Commented:
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 "~"
0
 
TextReportCommented:
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
0
 
mcelhanyAuthor Commented:
Still looking for an answer!
0
 
TextReportCommented:
Can you confirm that the default button is the Save option, also, have you tried ALT-S, in sendkeys it is %s
Cheers, Andrew
0
 
mcelhanyAuthor Commented:
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?
0
 
TextReportCommented:
There is no space between %S. Cheers, Andrew
0
 
mcelhanyAuthor Commented:
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.
0
 
TextReportCommented:
The use of SendKeys is not very scientific within windows and is dodgy at best. I have been onto Software602's website and they have a developers guide as to how to operate their software from code with example code for VB Script that could be adapted for VBA.

The general principal for the other PDF creators I have used have all used Registry Settings and/or INI files to determine the parameters for creating the PDF. Please take a look at http://download.software602.com/pdf/print2pdf/p2pdf8-dev.pdf as it will, once configured, make your application much more robust.

Cheers, Andrew
0
 
mcelhanyAuthor Commented:
Thanks, I'll give it a look tomorrow.
0
 
mcelhanyAuthor Commented:
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
0
 
TextReportCommented:
No problem and good luck. Andrew
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now