I did a solution for the PDF part of this a while ago, BUT this solution
REQUIRES the Full version of Adobe Acrobat be installed on the machine. For
me this was not an Issue.
Here is how I did it:
Create a new form and save it. This form gets no controls or code. We are
only gonna' use it as a container to display our PDF's.
Create another form and put a Subform Control on it that uses the form you
just saved as its Source Object. Make the name of the Subform CONTROL
sfrmForm2 Next add a list box control whose name is lstFiles. Set the Row
Source of the list box to unambiguous Filenames of a few PDF files somewhere
on your hard Drive. My Row Source was set thusly.
"c:\Inv83597.pdf";"c:\Inv83598.pdf";"c:\Inv83599_AOCR.pdf";"c:\rw_aocred.pdf
";"c:\test_ocred.pdf"
Add the following code to the Main form.
Option Compare Database
Option Explicit
Dim OffSetX As Long, OffSetY As Long
Dim AcroExchAVDoc As Object
Private Sub Form_Load()
Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set AcroExchAVDoc = Nothing
End Sub
Private Sub lstFiles_Click()
Dim blnOK As Boolean
Const AV_DOC_VIEW = 2
Const PDUseBookmarks = 3
Const AVZoomFitWidth = 2
' Open the selected file
On Error Resume Next ' if is already closed Blow past
error
AcroExchAVDoc.Close (False)
' Add your real Error handler here to catch any errors from here
blnOK = AcroExchAVDoc.OpenInWindowEx(lstFiles.Value, _
sfrmPDF.Form.hwnd, AV_DOC_VIEW, True, 0, _
PDUseBookmarks, AVZoomFitWidth, 0, 0, 0)
' See IAC.bas and the Acrobat Viewer IAC
' Overview for information on the
' OpenInWindowEx open modes
AcroExchAVDoc.SetViewMode 1
' Force a repaint to slow down the action
' so the combo does not get ahead
' of the form causing a crash when the
' Up or Down arrow us held down
sfrmPDF.Form.Repaint
If Not blnOK Then
MsgBox "Can't open file: " & lstFiles.Value
End If
End Sub
This is BARE BONES demonstration only code that simply opens the PDF in the
subform and allows the user to page through it. In real life you will need
to be able to handle a whole host of possible errors, resizing issues, menu
issues, etc. If you decide to go with a solution like this be sure to
download the Adobe Viewer IAC overview PDF (available from
http://www.adobe.com/support/main.html) for a whole bunch of stuff you can
do with the insides of a PDF.
Good Luck.
Ron W