|
-
Jul 3rd, 2002, 03:37 PM
#1
Thread Starter
New Member
ShellExecute
Hello,
I'm trying to print 1 or more pdf files from within Access 2000 vba. Users will have Acrobat Reader installed. I've found that the following command line works:
AcroRd32.exe /t <FileName> <PrinterName>
I can run this from Start/Run menu. I'm trying to put this feature into my vba code. What I have so far is this:
Public Function PrintPdf() As Long
Dim lRet As Long
Dim sFile As String
Dim sParms As String
sFile = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe"
sParms = " /t ""C:\Program Files\Adobe\Acrobat 5.0\Help\ENU\acrobat.pdf"" \\FIREHAT\HP4100-113"
lRet = ShellExecute(0, "open", sFile, sParms, "", SW_SHOWMINNOACTIVE)
PrintPdf = lRet
End Function
This seems to work, but leaves a copy of Acrobat Reader minimized in the taskbar. Is there any way to remove this when I'm done with it? I do have what seems to be a task id returned from the function. Is there an api method to kill that task, or would that simply add more time to the process (I will be looping through many records, and printing a pdf file for each one)? Maybe save the initial task id returned, and kill it once at the end, assuming the same task id is used in each ShellExecute iteration?
In any case, 1: How can I kill the task created, and 2: Should I be using ShellExecuteEx instead?
Thanks,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|