Not finding file to print

P

pdberger

Good afternoon --
I'm trying write a command to print a pdf file -- in this case, a W-9. I'm
getting a run-time error '53' -- file not found. Here's the command:

Shell "Start.exe""C:\Documents and Settings\Peter Berger\My
Documents\Personal\Credentialing App\W-9.pdf"

I've:
* checked to make sure that Acrobat is the default program for pdf files
* mega-checked that the file path and name are correct
* tried:
Shell "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & _
"C:\Documents and Settings\Peter Berger\My
Documents\Personal\Credentialing App\W-9.pdf", 1
with the same results.

Am I just not smart enough to name the path correctly, or is there something
in the command that I'm doing wrong?

Thanks in advance.
 
D

Dave Peterson

This worked ok for me:

Option Explicit
Sub testme()

Dim Progname As String
Dim myFileName As String

Progname = "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe"

myFileName = "C:\Documents and Settings\username\Desktop\test name.pdf"

Shell Progname & " " & myFileName, vbNormalFocus

End Sub

Notice the space between the name of the program and the name of the .pdf.

(I used winXP home and excel 2003 to test.)
 
P

pdberger

Dave --

You are absolutely 'da man! Thanks! A couple of quick questions, if you'll
let me prey on your patience:

* The W-9 prints out in gibberish -- when I print it manually immediately
afterwards, it prints out fine in English. Do you have any idea why that
might be happening? Am I missing an argument somewhere?
* What would the sendkeys command be to close the Acrobat app?

Thanks again in advance.
 
D

Dave Peterson

I don't have any guess why it doesn't print. Maybe it's time to check another
printer. If that works, get a fresh printer driver for your preferred
printer????

Maybe you can send the equivalent of File|Exit (ctrl-Q) to Reader. But using
sendkeys is a gamble at best. I don't recommend doing this if you're going to
share with others.

If it's for yourself, you can make sure you're not in the wrong application when
that ctrl-q hits.

(I'd hate to be about to click on an icon when your ctrl-q gets sent to my
program and the "do you want to save" pops up and I click yes in error.)

I'd just close the file manually if it were me.

(Maybe you could ask in one of the Adobe forums. Maybe they'll have a better
way??????)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top