Results 1 to 12 of 12

Thread: Error loading DLL, Excel automation

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Error loading DLL, Excel automation

    I have a VB6 program that uses the "Microsoft Excel 11.0 Object Library." It's been working fine for 2 days and then right when I was going to show it to some people I get this strange error. Whenever I get to the point where it uses Excel it breaks on the following line and says "Error loading DLL."
    Code:
    Set m_App = New Excel.Application
    I've restarted my computer, removed and readded the Excel reference, and ran "excel.exe /regserver", but nothing has made a difference.

    Why would it work for several days and then stop without cause?

    Thanks!
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Error loading DLL, Excel automation

    If MS Excel isn't installed on the destination machine automation will fail - MS Office must be installed. You cannot freely distribute any of its libraries.
    Also, if Excel is installed but different version then you better use late binding (sample below):
    Code:
    Dim myExcel As Object
    
    Set myExcel = CreateObject("Excel.Application")
    
    'continue with the rest of your code...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: Error loading DLL, Excel automation

    I guess I should mention this is my development machine. Nothing's been deployed yet. I just started this program last Friday, added the Excel portions on Monday, and yesterday, at the end of the day, it stopped working.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Error loading DLL, Excel automation

    Did anything change on your machine during the day?

  5. #5

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: Error loading DLL, Excel automation

    CreateObject("Excel.Application") is returning Nothing.

    The other thing that happened at the same time was the MS Common Controls components disappeared. I only used it for the progress bar, and the form failed to load in the VB IDE. When I looked in the Components/Controls list it was missing, not unchecked, just completeley gone from the list. When I restarted my computer it came back and I had to recreate the progress bar on the form. Then Excel started acting up.

    Here's the error in the form's log file when the progress bar failed to load:
    Line 18: Class MSComctlLib.ProgressBar of control pbProgress was not a loaded control class.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  7. #7

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: Error loading DLL, Excel automation

    Before I started this thread I tried creating a new project and just instantiating excel. Still had the same problem.

    I think I do need a new machine
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Error loading DLL, Excel automation

    Quote Originally Posted by Hack
    Did anything change on your machine during the day?
    I would second that question - what happend since it last worked? You must've done something - there are no miracles...

    Also, can you at least open Excel itself? Does it even work on your machine?

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    May 2001
    Posts
    837

    Re: Error loading DLL, Excel automation

    I swear I didn't do anything. I was working on the project, went to go get somebody to look at it and when they came a few minutes later it stopped working.

    I can open Excel.

    I just retried making a new project and instantiating Excel. It works this time. My project also works now - I had closed and reopened VB.

    Thanks to everyone who tried to help.
    The human brain cannot hold all of the knowledge that exists in this world, but it can hold pointers to that knowledge.

  11. #11

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Error loading DLL, Excel automation

    Things that "fix themselves" scare me. You never know when it will happen again. Even though it seems to be working now, I would think your situation would bare further investigation on your end.

Posting Permissions

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



Click Here to Expand Forum to Full Width