PC Review


Reply
Thread Tools Rate Thread

Print command from file rightclick?

 
 
dymondjack
Guest
Posts: n/a
 
      14th Feb 2009
Hello all, TIA for any input

Is it possible to access the Print command that can be found when
right-clicking a printable file?

I've got a document system that contains various different filetypes (mostly
xls, doc, pdf, dwg and edwg files), and I would like to be able to have the
users open the Print Dialog without having to open the file to print it.

Any ideas? I haven't been able to come up with much online, just examples
of how to print specific filetypes.

In a worst case scenario I can evalute the filetype via code and run the
appropriate function for that type, but if it's possible to somehow read the
registry for the filetype (see if it has an associated 'Print' command) and
execute that command, that would be great.

Thanks again!

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      14th Feb 2009
You might try asking this question in one of the Windows newsgroups. This
group discusses Microsoft Access, the desktop database.

If you are trying to print an Access report, you can drag it from the
Database Window (or Nav Pane in A2007) to the Windows desktop to open it
directly. Or, you can create a macro to print the report directly, and
create a shortcut to the macro.

If VBA code, you can FollowHyperlink to start the registered file type, or
you can ShellExecute:
http://www.mvps.org/access/api/api0018.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dymondjack" <dymondjack at hot mail dot com> wrote in message
news:57E452E6-0FEC-41F8-9B67-(E-Mail Removed)...
> Hello all, TIA for any input
>
> Is it possible to access the Print command that can be found when
> right-clicking a printable file?
>
> I've got a document system that contains various different filetypes
> (mostly
> xls, doc, pdf, dwg and edwg files), and I would like to be able to have
> the
> users open the Print Dialog without having to open the file to print it.
>
> Any ideas? I haven't been able to come up with much online, just examples
> of how to print specific filetypes.
>
> In a worst case scenario I can evalute the filetype via code and run the
> appropriate function for that type, but if it's possible to somehow read
> the
> registry for the filetype (see if it has an associated 'Print' command)
> and
> execute that command, that would be great.
>
> Thanks again!
>
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your
> leisure."
> - Mark Twain


 
Reply With Quote
 
 
 
 
dymondjack
Guest
Posts: n/a
 
      14th Feb 2009
I was wondering about a way (in Access) to accomplish the same thing as what
gets done when clicking the Print command from the right-click dropdown.

I am aware of ways to print reports from within access, but the files I am
looking to print are not reports. I am also aware of the ShellExecute API
(which is the current method that I use), but am trying to devise a way to
print these various files without having the user open the file and then
click the print button.

As the OS can apparently print a file without opening it (or open the file
and call the print dialog without user intervention, and close the file
after), I was hoping maybe there was a way to access that particular OS
procedure via Access (perhaps an API?).

I think though, that if this were possible, there would be a lot more people
doing it.

I suppose I can move to the Windows newsgroup and see about a possible
script that can be called from vba, but I was hoping to find something
directly in access.

Thanks for the suggestions.

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Allen Browne" wrote:

> You might try asking this question in one of the Windows newsgroups. This
> group discusses Microsoft Access, the desktop database.
>
> If you are trying to print an Access report, you can drag it from the
> Database Window (or Nav Pane in A2007) to the Windows desktop to open it
> directly. Or, you can create a macro to print the report directly, and
> create a shortcut to the macro.
>
> If VBA code, you can FollowHyperlink to start the registered file type, or
> you can ShellExecute:
> http://www.mvps.org/access/api/api0018.htm
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "dymondjack" <dymondjack at hot mail dot com> wrote in message
> news:57E452E6-0FEC-41F8-9B67-(E-Mail Removed)...
> > Hello all, TIA for any input
> >
> > Is it possible to access the Print command that can be found when
> > right-clicking a printable file?
> >
> > I've got a document system that contains various different filetypes
> > (mostly
> > xls, doc, pdf, dwg and edwg files), and I would like to be able to have
> > the
> > users open the Print Dialog without having to open the file to print it.
> >
> > Any ideas? I haven't been able to come up with much online, just examples
> > of how to print specific filetypes.
> >
> > In a worst case scenario I can evalute the filetype via code and run the
> > appropriate function for that type, but if it's possible to somehow read
> > the
> > registry for the filetype (see if it has an associated 'Print' command)
> > and
> > execute that command, that would be great.
> >
> > Thanks again!
> >
> > --
> > Jack Leach
> > www.tristatemachine.com
> >
> > - "First, get your information. Then, you can distort it at your
> > leisure."
> > - Mark Twain

>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      14th Feb 2009
Okay, I'm sure there probably is an API call to perform that report
operation, but I don't know it off the top of my head.

Perhaps you could search at one of the API for VB sites, such as:
http://vbnet.mvps.org/

Or perhaps someone else will have a suggestion for you.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"dymondjack" <dymondjack at hot mail dot com> wrote in message
news:46B9C9D2-652B-472E-9332-(E-Mail Removed)...
>I was wondering about a way (in Access) to accomplish the same thing as
>what
> gets done when clicking the Print command from the right-click dropdown.
>
> I am aware of ways to print reports from within access, but the files I am
> looking to print are not reports. I am also aware of the ShellExecute API
> (which is the current method that I use), but am trying to devise a way to
> print these various files without having the user open the file and then
> click the print button.
>
> As the OS can apparently print a file without opening it (or open the file
> and call the print dialog without user intervention, and close the file
> after), I was hoping maybe there was a way to access that particular OS
> procedure via Access (perhaps an API?).
>
> I think though, that if this were possible, there would be a lot more
> people
> doing it.
>
> I suppose I can move to the Windows newsgroup and see about a possible
> script that can be called from vba, but I was hoping to find something
> directly in access.
>
> Thanks for the suggestions.
>
> --
> Jack Leach
> www.tristatemachine.com
>
> - "First, get your information. Then, you can distort it at your
> leisure."
> - Mark Twain
>
>
> "Allen Browne" wrote:
>
>> You might try asking this question in one of the Windows newsgroups. This
>> group discusses Microsoft Access, the desktop database.
>>
>> If you are trying to print an Access report, you can drag it from the
>> Database Window (or Nav Pane in A2007) to the Windows desktop to open it
>> directly. Or, you can create a macro to print the report directly, and
>> create a shortcut to the macro.
>>
>> If VBA code, you can FollowHyperlink to start the registered file type,
>> or
>> you can ShellExecute:
>> http://www.mvps.org/access/api/api0018.htm
>>
>> "dymondjack" <dymondjack at hot mail dot com> wrote in message
>> news:57E452E6-0FEC-41F8-9B67-(E-Mail Removed)...
>> > Hello all, TIA for any input
>> >
>> > Is it possible to access the Print command that can be found when
>> > right-clicking a printable file?
>> >
>> > I've got a document system that contains various different filetypes
>> > (mostly
>> > xls, doc, pdf, dwg and edwg files), and I would like to be able to have
>> > the
>> > users open the Print Dialog without having to open the file to print
>> > it.
>> >
>> > Any ideas? I haven't been able to come up with much online, just
>> > examples
>> > of how to print specific filetypes.
>> >
>> > In a worst case scenario I can evalute the filetype via code and run
>> > the
>> > appropriate function for that type, but if it's possible to somehow
>> > read
>> > the
>> > registry for the filetype (see if it has an associated 'Print' command)
>> > and
>> > execute that command, that would be great.
>> >
>> > Thanks again!
>> >
>> > --
>> > Jack Leach
>> > www.tristatemachine.com
>> >
>> > - "First, get your information. Then, you can distort it at your
>> > leisure."
>> > - Mark Twain

>>
>>


 
Reply With Quote
 
RoyVidar
Guest
Posts: n/a
 
      14th Feb 2009
dymondjack wrote:
<snip>

> As the OS can apparently print a file without opening it (or open the
> file and call the print dialog without user intervention, and close
> the file after), I was hoping maybe there was a way to access that
> particular OS procedure via Access (perhaps an API?).




> "Allen Browne" wrote:


>> http://www.mvps.org/access/api/api0018.htm



The ShellExecute api, pass it "Print" in stead of vbNullString as
second parameter.

I e - here's an alternation of the code in the link Allen Browne
posted

lRet = apiShellExecute(hWndAccessApp, "Print", _
stFile, vbNullString, vbNullString, lShowHow)

See also http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

This will sometimes leave an instance of the program printing the file
open/visible - something that usually happens with Acrobat. Here's
one thread I found one elsewhere addressing that issue.
http://www.tek-tips.com/viewthread.c...489448&page=14

--
Roy-Vidar


 
Reply With Quote
 
dymondjack
Guest
Posts: n/a
 
      14th Feb 2009
I do believe that is what I am looking for. I wasn't aware that the
ShellExecute API could take a print parameter.

I spent about three hours yesterday searching for a way to do this. I
finally gave up after I found myself trying to decipher some C code for
functions to use the windows spooler <shudder>

thanks guys
--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"RoyVidar" wrote:

> dymondjack wrote:
> <snip>
>
> > As the OS can apparently print a file without opening it (or open the
> > file and call the print dialog without user intervention, and close
> > the file after), I was hoping maybe there was a way to access that
> > particular OS procedure via Access (perhaps an API?).

>
>
>
> > "Allen Browne" wrote:

>
> >> http://www.mvps.org/access/api/api0018.htm

>
>
> The ShellExecute api, pass it "Print" in stead of vbNullString as
> second parameter.
>
> I e - here's an alternation of the code in the link Allen Browne
> posted
>
> lRet = apiShellExecute(hWndAccessApp, "Print", _
> stFile, vbNullString, vbNullString, lShowHow)
>
> See also http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx
>
> This will sometimes leave an instance of the program printing the file
> open/visible - something that usually happens with Acrobat. Here's
> one thread I found one elsewhere addressing that issue.
> http://www.tek-tips.com/viewthread.c...489448&page=14
>
> --
> Roy-Vidar
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print an excel file from command line or "cron" type command ??? Chris Salcedo Microsoft Excel Programming 2 28th Mar 2007 01:10 AM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 Security 6 1st May 2006 02:51 PM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 Networking 1 29th Apr 2006 02:42 AM
after a ftp put command it just says "200 PORT command successful." and hangs forever. What could be wrong? when i test the ftp server using IE in "passive" mode it works fine. but ftp at command line hangs on "200 PORT comma Daniel Microsoft Windows 2000 1 29th Apr 2006 02:05 AM
Change Print Command or add a new print command =?Utf-8?B?RGFuaWVsIFIuIFlvdW5n?= Microsoft Excel Programming 3 11th Nov 2005 06:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:20 PM.