|
-
Aug 2nd, 2007, 07:22 AM
#1
Thread Starter
Fanatic Member
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.
-
Aug 2nd, 2007, 07:26 AM
#2
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...
-
Aug 2nd, 2007, 07:33 AM
#3
Thread Starter
Fanatic Member
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.
-
Aug 2nd, 2007, 07:36 AM
#4
Re: Error loading DLL, Excel automation
Did anything change on your machine during the day?
-
Aug 2nd, 2007, 07:37 AM
#5
Re: Error loading DLL, Excel automation
In that case try the late binding as I showed you. If that doesn't work then you may need to reinstall your Office.
-
Aug 2nd, 2007, 07:43 AM
#6
Thread Starter
Fanatic Member
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.
-
Aug 2nd, 2007, 07:46 AM
#7
Re: Error loading DLL, Excel automation
Rebuild your project then - basically create a brand new and add all of your existing forms/modules and save new project by overwriting the old one.
If that doesn't help then maybe you a new machine...
-
Aug 2nd, 2007, 07:58 AM
#8
Thread Starter
Fanatic Member
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.
-
Aug 2nd, 2007, 07:59 AM
#9
Re: Error loading DLL, Excel automation
 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?
-
Aug 2nd, 2007, 08:17 AM
#10
Thread Starter
Fanatic Member
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.
-
Aug 2nd, 2007, 08:47 AM
#11
Re: Error loading DLL, Excel automation
Alright.
-
Aug 2nd, 2007, 08:48 AM
#12
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|