# IronRuby for Office AddIns

**URL:** <https://www.ruby-forum.com/t/ironruby-for-office-addins/199922>\
**Category:** IronRuby\
**Created:** [December 1, 2010, 1:37pm UTC](https://www.ruby-forum.com/t/ironruby-for-office-addins/199922 "2010-12-01T13:37:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [December 1, 2010, 1:37pm UTC](https://www.ruby-forum.com/t/ironruby-for-office-addins/199922/1 "2010-12-01T13:37:46Z")

</div>

Hi,

I’d like to write an Outlook(2003 & 2010)-AddIn in Ruby (IronRuby), but  
I’m not pretty sure, whether this is possible.  
The AddIn should bring up a new icon in Outlooks’ CommandBar and should  
read contact items.

I just found some examples, where they put Ruby-Code into a C#-Wrapper  
what is not what I want.

The main thing I want to avoid (to be honest) is that I don’t want to  
have to buy Visual Studio for a couple of hundreds (thousands?) of  
dollars.

I am new to the whole .NET-World and I’m not much into the concept by  
now.

Can you give me a hint to point me in the right direction?

Thanks,

Josch

---

<div class="post-metadata">

**Author:** ![josch13](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8e8cbc/32.png) [@josch13](https://www.ruby-forum.com/u/josch13)\
**Post date:** [December 2, 2010, 3:17am UTC](https://www.ruby-forum.com/t/ironruby-for-office-addins/199922/2 "2010-12-02T03:17:59Z")

</div>

You can download Visual C# Express for free. There is also the  
MonoDevelop IDE which is free. Beside that you can use any text editor  
together with the ironruby and c# compiler to work in any way you want  
🙂

I am not certain how the Office addin’s work but usually that kind of  
thing works with a (.net) dll that exposes some interface  
implementation. I’d advice you to look into what kind of interface  
Office has, and wether you can do this by compiling a ruby file to a  
dll, or making a small c# wrapper which invokes the ruby code in a  
separate file or embedded resource.

I hope I gave you some terms to google 🙂

Cheers,  
Tinco

---

<div class="post-metadata">

**Author:** ![josch13](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8e8cbc/32.png) [@josch13](https://www.ruby-forum.com/u/josch13)\
**Post date:** [December 3, 2010, 8:11pm UTC](https://www.ruby-forum.com/t/ironruby-for-office-addins/199922/3 "2010-12-03T20:11:12Z")

</div>

Jascha,

You’re need to write a small host for IronRuby in a static .NET  
language, as  
the Office add-in API most likely requires an actual assembly with  
actual  
CLR types to be loaded. However, with a minimal shim to host IronRuby in  
an  
office add-in, you can then write the actual logic of your add-in in  
IronRuby. This is the only way IronRuby can run; ir.exe is the IronRuby  
runner for cmd.exe, irw.exe is the Windows runner, and  
Microsoft.Scripting.Silverlight.dll is the runner for Silverlight. If  
there  
is a shim that isn’t part of IronRuby itself, you can use the very  
simple  
Microsoft.Scripting.Hosting APIs directly to run IronRuby in a custom  
way.

However, you also want to develop add-ins without purchasing VSTO (VS  
Tools  
for Office). In that case, would you be able to get away with writing a  
program external to Office that controlled it? If so, you can either use  
the  
Office interop assemblies (  
[Faster MS Excel Reading using Office Interop Assemblies - CodeProject](http://www.codeproject.com/KB/office/fasterexcelaccesstoc.aspx)) or use  
the  
Win32OLE module in IronRuby to automate Office; this option also avoids  
the  
static-.NET shim.

~Jimmy
