ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Not finding file to print (https://www.excelbanter.com/excel-programming/391902-not-finding-file-print.html)

pdberger

Not finding file to print
 
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.

Dave Peterson

Not finding file to print
 
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.)


pdberger wrote:

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.


--

Dave Peterson

pdberger

Not finding file to print
 
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.

"Dave Peterson" wrote:

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.)


pdberger wrote:

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.


--

Dave Peterson


Dave Peterson

Not finding file to print
 
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??????)

pdberger wrote:

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.

"Dave Peterson" wrote:

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.)


pdberger wrote:

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.


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com