Hi,

I am getting the run time error 432 (File name or class name not found during automation operation) while trying to use GetObject with xlsx files.

It's strange because the function works fine while trying to use it on xlsm filetypes.

I've been trying many suggested solutions from web, and nothing worked

I don't want to use "workbooks.Open" because I would have to rebuild almost everything in a specific tool.

It used to work fine on previous 2013 office version, since i've updated to office 365 this error started to occur.

Code below:


Sub GetObject_Testing()

Dim MyExcel As Excel.Workbook
Dim MySheet As Worksheet
Dim MyFilePath As String


'Set MyExcel = GetObject("Excel.Application")

MyFilePath = "C:\Users\me\Desktop\Teste_XLSX.xlsx


Set MyExcel = GetObject(MyFilePath)


For Each MySheet In MyExcel.Sheets
Debug.Print MySheet.Name
Next MySheet

End Sub


Thank you