ciao John,
I think no need to use automation to achieve your task, try replace your code by this solution.
Into standard or general module :
Option Compare Database
Option Explicit
Private Const strPathPDF As String = "C\placeYourPathHere" ' to be customized.
Public Function cmdFileDialog() As String
Dim fDialog As Object
Dim strFile As String
Dim varFiles As Variant
Set fDialog = Application.FileDialog(3)
With fDialog
.Title = "select Excel files:"
.AllowMultiSelect = True
.Filters.Clear
.Filters.Add "files PDF", "*.xlsx"
.InitialFileName = strPathPDF
If .Show Then
strFile = .SelectedItems(1)
Else
strFile = vbNullString
End If
End With
cmdFileDialog = strFile
End Function
Public Sub openFileName(ByVal strFullPath As String)
CreateObject("Shell.Application").Namespace(0).ParseName(strFullPath).InvokeVerb "Open"
End Sub
Public Function FileExists(strPathFile As String) As Boolean
On Error Resume Next
FileExists = ((GetAttr(strPathFile) And vbDirectory) = 0)
End Function
the following code instead to open and work with your excel file :
Private Sub cmdOpen_Click()
If FileExists(Me.fullPathPDFfile) Then openFileName Me.fullPathPDFfile
End Sub
supposing to invoke it by a command button called cmdOpen placed into a form.
HTH.
Ciao, Sandro.