Hej!
Jag har en .NET-komponent som jag vill använda i Excel/VBA. Jag har då använt verktyget regasm för att skapa en .tlb-fil utifrån .Net-dll:en.
Jag letar sedan upp tlb-filen via Tools>References i VBEditor i Excel.
Intellisensefunktionen fungerar när jag kodar så allt verkar OK men när jag skall köra excelkoden så får jag
"No server registered or could not load class for CLSID {23232-osv}
Har hört att det har att göra med sökvägen på något sätt, men vet inte vad jag skall göra
renholmMedlem sedan apr. 20012 266 inlägg har du kollat på msdn och support.microsoft.com ?
Ja, det har jag.
Jag har hittat följande text i min .NET-bok där samma fel är beskrivet.
In COM, the location of the dll containing the component is available via the registry. In .NET the assembly always has to be either in the current directory or the global assembly. All the registry is doing is converting a com refernce to a .NET one; it is not finding the .NET one for us.
But it is easy to sort out. All we have to do is move the .NET assembly to our current directory.
Jag lyckades faktiskt med detta när jag istället för Excel körde från VB6 och kopierade .NET-dll:en till mappen för VB6-projektet.
Men jag vill ju köra denna från Excel...
Hurra! Jag löste det! .NET-dll:en måste kopieras till samma mapp som referensen för Microsoft Excel 10.0 Object Library.
Det funkar!