Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendkeys passing to save as dialog

Status
Not open for further replies.

markbrum

Technical User
Mar 10, 2003
46
0
0
GB
Hi,

I have produced a macro which loops to automate the printing of a series of reports which works fine. However I would like to instead save these reports as pdf by just printing to distiller.

To do this i need to deal with the save as dialog box. I would like to call them reportX.pdf reportY.pdf etc where I pass X or Y to the box. I have tried to use sendkeys - i am a vbscript dummy and so wanted to use the macro builder - to create a macro with 2 steps :-
1. sendkeys filenameX.pdf {ENTER}
2. open report in print view

this is not working though, can anyone help?

Thanks,

Mark.
 
Try looking at the VBA help file for SendKeys.

You probably need to specify the application you want the keys sent to.

I believe it would be something like this if I rembmer correctly:

Code:
AppActivate ("Name of the Program/Window to send keystroke to")
SendKeys "filenameX.pdf"
SendKeys "{ENTER}"
 
afraid i couldn't get this working at all.

for anyone interested, here's how i solved the problem another way:-

1. leave the report caption blank
2. insert the following page event (wouldn't work when attached to the report header, i think because the source field hadn't loaded before it was called):-
Private Sub Report_Page()
Me.Caption = "Reportname " & Me.Textfield
End Sub
3. use a program called pdf995 ($9.95) which can be set to accept the caption of a report as its pdf file name without opening a dialog

mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top