Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok firstly, I found that there are a number of issues with .net COM dlls interaction with VBA. </p> <p>Firstly, configuring them in with .net via attributes, so they correctly configured in the registry is important. Make sure the Dll project has been marked Register for COM interop.</p> <p>Secondly, if you using an MSI project, ensure that the software has been marked "Install all users". MSI projects do a very poor job of removing registry entries, so if you muck up MSI installs, .net version etc your server ends up with "bad registry entries". I end up using regasm.exe to correctly register the component. I've ended up moving to WIX project installs.</p> <p>Thirdly, you need to ensure that the registry entries are "machine/global" wide, for terminal server, as each users will be running a potentially different set of "registry" entries. If you have setup the namespaces correctly, you should be able to do early binding in VBA, rather than the riskier late binding "CreateObject" calls. Just make sure the VBA checks for "broken references" during startup.</p> <p>Forth, I use a very clean VM to test my installations and registry entries, with the help of MS Office VBA References, to confirm the COM parts have registered correctly, so "CreateObject" calls are not going to fail.</p> <p>Fifth, watch out for the x86/x64 issues with Terminal server and the explicit version of office your running (Office 2010 x64 in particular). You may have to use the compiler flags /86 explicitly if the server is a x64 (Any CPU can be very bad for VBA .net COM objects).</p> <p>Sixth, Watch out for the way you raise exceptions from .net to COM. Have a look at System.Runtime.InteropServices.COMException for the correct approach.</p> <pre><code>From cmd c: cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727{or the edition your using} COPY "\\Distribution Share\{YourCompany}\{Software}\{Edition}\{.net Com DLL name}.dll" "C:\Program Files\{YourCompany}\{Software}\{.net Com DLL name}.dll" Regasm.exe "C:\Program Files\{YourCompany}\{Software}\{.net Com DLL name}.dll" /u Regasm.exe "C:\Program Files\{YourCompany}\{Software}\{.net Com DLL name}.dll" /regfile:"C:\Program Files\{YourCompany}\{Software}\{.net Com DLL name}.reg" /codebase cd C:\WINDOWS\System32\ Regedit.exe /s "C:\Program Files\{YourCompany}\{Software}\{.net Com DLL name}.reg" </code></pre> <p>I then have a really close look at the registry files that are generated to ensure they are in the correct registry hive.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload