E
Eutychus
I want to use VBA to control the values in the "Save In," "File Name," and
"Save as Type" text boxes when the Save As Dialog box pops up. I don't know
how to refer to those text boxes to set their values. I also want to use VBA
to "click" the Save button. I am using Access 2002-3 with Windows XP, but
want this to work with Access 2003 on a Vista machine, too. Here is what I
do:
1) On an Access form, the user clicks a "Print Report" button to print an
Access report.
2) The code behind the button executes the DoCmd as follows:
stDocName = "My Report Name"
DoCmd.OpenReport stDocName, acViewPrint
3) The Save As dialog box pops up because the Page SetUp for the report has a
Virtual PDF printer selected to save the report to a PDF file.
4) It is at this point that I want to control the values in the Save As
dialog box and close the dialog box (or let it close automatically when the
"Save" button is programmatically "clicked" using VBA).
I've tried using SendKeys but that is inconsistent and partial at best.
My aim is to create a PDF file from the report with the name and location
that I control. I want the user to click a button and have everything happen
automatically. I don't want the user to select the printer or create the
file name or type. I would think this is relatively simple, but it has
eluded me for days. Is there anyone who can help especially with specific
code samples?
By the way, I've read of doing API calls but have not done that before and
from what I've read, it seems like a lot of unnecessary code for something
simple. Maybe I'm wrong, but isn't there a simpler solution?
I would really appreciate any help! Thanks in advance!
"Save as Type" text boxes when the Save As Dialog box pops up. I don't know
how to refer to those text boxes to set their values. I also want to use VBA
to "click" the Save button. I am using Access 2002-3 with Windows XP, but
want this to work with Access 2003 on a Vista machine, too. Here is what I
do:
1) On an Access form, the user clicks a "Print Report" button to print an
Access report.
2) The code behind the button executes the DoCmd as follows:
stDocName = "My Report Name"
DoCmd.OpenReport stDocName, acViewPrint
3) The Save As dialog box pops up because the Page SetUp for the report has a
Virtual PDF printer selected to save the report to a PDF file.
4) It is at this point that I want to control the values in the Save As
dialog box and close the dialog box (or let it close automatically when the
"Save" button is programmatically "clicked" using VBA).
I've tried using SendKeys but that is inconsistent and partial at best.
My aim is to create a PDF file from the report with the name and location
that I control. I want the user to click a button and have everything happen
automatically. I don't want the user to select the printer or create the
file name or type. I would think this is relatively simple, but it has
eluded me for days. Is there anyone who can help especially with specific
code samples?
By the way, I've read of doing API calls but have not done that before and
from what I've read, it seems like a lot of unnecessary code for something
simple. Maybe I'm wrong, but isn't there a simpler solution?
I would really appreciate any help! Thanks in advance!