title: Can't instantiate .net object in vba
body: <p>I created a class library project in visual studio express 2010, vb.net. </p>
  
  <p>I checked Project / Application / Assembly Information / Make assembly COM-Visible. </p>
  
  <p>I built the project. </p>
  
  <p>I copied myproject.dll and myproject.tlb to C:\WINNT\system32</p>
  
  <p>I ran C:\WINNT\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe myproject.dll /codebase. (I get "warning RA0000", but then "Types Registered successfully".) </p>
  
  <p>I look in regedit, and I find keys for my classes in HKEY_Classes_Root/CLSID and /classname and /TypeLib. </p>
  
  <p>In Excel in the VBA editor, I go to Tools/References, and add a Reference to the tlb file in the system32 folder. (The reference does not appear in the References folder in the project manager.) </p>
  
  <p>In VBA, I write: </p>
  
  <pre><code>Dim y as string
  Dim x as myproject.myobject
  set x = New myproject.myobject
  y = x.testfunction(Input:="Hi")
  </code></pre>
  
  <p>Intellisense recognizes myproject, and after typing my project it also prompts all my class names. And on the method call, both the method name and parameter name are automatically capitalized. </p>
  
  <p>When I step through the code, at </p>
  
  <pre><code>set x = New myproject.myobject
  </code></pre>
  
  <p>I get error: Run-time error'-2146233065 (80131517)':   Automation error</p>
  
  <p>If I declare x as Variant instead, with some of my classes I can instantiate and access members. With others I get the same error. </p>
  
  <p>I also tried the hack with Excel.exe.config file, and .net version, in the excel application folder. </p>
  
  <p>Can anyone help? Sorry this is my first time compiling an add-in, and I think it must be simple. But there's not a lot of guidance or clarity in the process, it seems to me. </p>
  
  <p>Thanks. </p>