dcsimg
Results 1 to 2 of 2

Thread: VBA Runtime Error 432 GetObject Function

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2020
    Posts
    1

    VBA Runtime Error 432 GetObject Function

    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

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,542

    Re: VBA Runtime Error 432 GetObject Function

    The code works for me on Excel 2010 32 bit, however, it does NOT work on Office 365 Excel 64 bit.

    Possibly useful link:

    https://stackoverflow.com/questions/...ot-found-durin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width