Well... the reference must be there or the code will not compile using the "Dim As" mechanism. But just because the reference is there doesn't mean the dll still exists.
However, as Marco has mentioned, this is the error you get when you are working with a library dll like Kernel32.dll, and not ActiveX dlls.
However - it is not specifically stated, so I am asking directly: Is the dll running in COM+ on the server machine? You state you have exported the proxy, so I assume you have exported the proxy using COM+. Is this correct? If you have done that, I must assume you have installed the proxy into COM+ on your client machine. Is this correct?
When you use "Dim Baz As Foo.Bar" how are you instantiating the object? Set Baz = New Foo.Bar?
When you say CreateObject("Foo.Bar") works, what do you mean by "works". Is it that all the functionality and all the method calls are working when you do this? Do you have methods that allow you to test and prove that the DLL is running on the server machine? Does it work using CreateObject using the COM+ proxy with the code running on the remote server? etc....
You are leaving out a lot of information if you expect anyone to be able to help you out.
Things like... what code is in the line code that causes the error? The "Dim" statement can't cause a runtime error - it isn't a line of code. It is just a declaration.
There could be a number of causes for this error.
Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems