+ Reply to Thread
Results 1 to 18 of 18

automation error - element not found

  1. #1
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    automation error - element not found

    Hi
    I am getting:

    run time automation error 2147319765(8002802b)
    automation error
    element not found

    when trying to run this code. The first sheet is named ok, the error comes for the 2nd and subsequent sheets.

    I'm using Excel 2007

    Any suggestions?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: automation error - element not found

    Do you get that error for any workbook or just 1 in particular?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    Are you running this code in Excel?
    Does the active workbook have any code in it? If so, does it compile? Are there a lot of controls on the worksheets?
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    The macro works for the first sheet, returning a message box saying "Sheet1", but falls over when it comes to naming the second or subsequent sheets.

    I have copied the code into another workbook and it works fine. It also used to work in the current workbook until a few days ago, but no longer does.

    I'm running this in Excel. There are other macros in the modules, and some formulas and functions in the worksheets, but nothing fancy, and no active controls etc. All other macros and functions are working fine.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    If you open the VB Editor and choose Debug-Compile project, do you get any errors?

  6. #6
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    debug complie yields:

    "object library invalid or contains references to object definitions that could not be found "

    had a quick look in tools > references but couldn't see any with "Missing" next to them

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    If you close Excel, search your C drive (including hidden and system folders) for *.exd files and delete them, then restart Excel, do you have the same problem?

  8. #8
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    No, alas didn't work. All the .exd files were several months old
    thanks for your persistence with this

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    Did any .exd files get recreated after you reloaded the workbook?

  10. #10
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    yes - 3 files, each copied into 2 separate directories
    files were:

    Refedit.exd
    MscomCtl2.exd
    Msforms.exd

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    OK. I suspect the common controls might be the issue. Are they actually in use in the workbook?

    You may also want to have a read of this - there's a link at the bottom for a safe version of the comctl2 control.

  12. #12
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    It looks like this might be the problem, but I can't these filenames in references or the c:\drive
    Am I missing something - how can I tell if thety're in use?
    cheers

  13. #13
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    Hi all
    I'm off out for the evening but will check this thread tomorrow - about 10 hours
    thanks for your help
    Nicky
    Last edited by NickyC; 07-13-2011 at 06:15 AM. Reason: correct typo

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    Do you have a reference set to the MS Windows Common Controls?

  15. #15
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    No, and it's not in the menu options in tools > references.

    I found a file called mmcfx.common.resources.dll on th c:\ drive, but when I tried to add a reference to it in VBA project I got the message "Can't add a reference to the specified file"

  16. #16
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    The mscomctl32.ocx file should be in your Windows\system32 directory. Try setting a reference to it.

  17. #17
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: automation error - element not found

    I found a file mscomct2.ocx that seems to contain common controls and succesully loaded it, but the macro still fails.

    I have created a copy of the file and copied my code into its modules and for now the copied macro seems to be working ok. It could be some corruption to the original file or a security update that disabled a control in the file, as the website you posted to suggests.

    For now I'll work with the copy, and cross fingers it doesn't happen again.

    Thank you very much for your patience and persistence on this one - it seemed like the world's simplest macro, but apparently not.

    Best wishes

    Nicky

  18. #18
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: automation error - element not found

    Glad you figured out a solution for it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1