To automate Ruby via VBscript, JScript or VB.Net and for Ruby to communicate with MSOffice (via Exports.js) and for MSOffice to communicate with Ruby (via VBA macros or add-ins), the Ruby type library must be registered as a COM object.
From Ruby versions 3.x (32 bit) or 4.x (64 bit), registration is done automatically as part of the Windows installation process. If you have installed manually (by direct unzipping or file copy), or if the registration has been broken in some way, then this is how to register directly:
- Run a Command Prompt as Administrator
Make sure that “Administrator:” is in the caption. If you do not have Administrator rights, then you will need to get your local IT support to perform these steps.
2. Navigate up to the root using cd.. and then down to \Ruby using cd Ruby (or to wherever your Ruby.exe may be)
3. Type ruby.exe /regserver and press Enter
No message should mean that the registration was successful.
As quick test, open a table and export to Excel using Send to | Any MS Office.
If you have Ruby installed more than once on the same machine, and want to check which one is registered
- Close Ruby
- Confirm on Task Manager that there are no phantom or zombie Ruby instances (can happen if a script does not complete), and if so, right-click End Task
- Run \Ruby\AutoEdit.exe
- Open \Ruby\CheckRubyRegistration.vbs
- Run the script
You should see a message box with the registered path.
If you uninstall Ruby from Control Panel | Programs and Features, then unregistering happens automatically.
If you want to remove manually, or move by file copy or file move to a different location, then first open a Command Prompt as Administrator as above, but this time enter
You MUST do this before removing/moving. Once Ruby.exe is somewhere else, if not unregistered first, your registry will have bad entries which can then only be deleted by manually editing the registry using regedit.exe. This is not advised unless you are sure you know what you are doing.
If you are still experiencing problems, contact our support team at email@example.com