it******@manx.net (S Taylor) wrote in message news:<55**************************@posting.google. com>...
I have looked through many newsgroups to see how I can print several
pdf documents to a printer, from Access using vba. The documents are
scans of images, so I don't think they can be open through Word as
text files. Ideally, I would like to use more solid code other than
Shell, but it seems that it is only the way. Using switches. /h /p, I
think!!
I do not alot about using switches and the Shell command, but would
like my code to do something like this
1. Open Adobe Reader
2. Loop through various pdf files, print & close them
3. Close Adobe Reader
Do I have to launch Adobe Reader everytime I open the pdf document?
How do I locate reader if my users are using different versions?
I have also noticed that the documents open up in internet explorer,
is there any way of controlling Internet Explorer from Access? If so
what is the Type Library.
Please, please, could somebody point me in the right direction?
Thanks.
Regards,
Steven Taylor
If you use the default folder when you install Acrobat Reader you can
use the following function:
'----------------------
Public Function GetAcroPath() As String
Const LatestVer = 6
Dim strAcroDir(LatestVer - 2) As String
Dim I As Integer
strAcroDir(1) = "C:\Program Files\Adobe\Acrobat 3.0\Reader\"
strAcroDir(2) = "C:\Program Files\Adobe\Acrobat 4.0\Reader\"
strAcroDir(3) = "C:\Program Files\Adobe\Acrobat 5.0\Reader\"
strAcroDir(4) = "C:\Program Files\Adobe\Acrobat 6.0\Reader\"
'strAcroDir(5) = "C:\Program Files\Adobe\Acrobat 7.0\Reader\"
strLocatedAcroDir = ""
For I = LatestVer - 2 To 1 Step -1
If Dir(strAcroDir(I), vbDirectory) <> "" Then
strLocatedAcroDir = strAcroDir(I)
Exit For
End If
Next I
GetAcroPath = strLocatedAcroDir & "AcroRd32.exe"
End Function
'----------------------
Note: You can check for the existence of this file before trying a
ShellExecute API function. Acrobat Reader works much faster when the
files are opened and closed without exiting.
If Acrobat Reader doesn't have all the command line switches you need
it may also be possible to use the Acrobat SDK to set up automation.
Acrobat Reader does not provide natively the automation interface that
would solve your problem simply. Perhaps Acrobat Reader Extensions
exposes such an interface. I would also check out the 3rd party
plug-ins listed on Adobe's site:
http://www.adobe.com/products/plugins/acrobat/main.html
Using the IE interface provides some other automation possibilities
when something like pdf.ocx is used.
I hope some of this helps,
James A. Fortune
Is a novice EBay user an EBaby?