views:

136

answers:

2

Hi, I don't know much about .net, but I am working on a project where a requirement is to port some Excel VBA code embedded in spreadsheets to standalone C# .

Are they any tools that could automate (or semi-automate) this port or compile? How well do they work?

+5  A: 

No. Your best bet, if it's not alot of code is to do it by hand.

Otherwise, you mileage might vary. You might try converting the VBA to VB.NET and then use a tool to convert that to C#.

Converting Code from VBA to Visual Basic .NET

Ten Code Conversions for VBA, Visual Basic .NET, and C#

Mitch Wheat
+1. If I may also add. . . On "how well do they work?", quite well for what they do, but there **will** be considerable development work required to get the VBA to VB port to run, more to get it working correctly.
Binary Worrier
+1 Do it by hand, even if it is lots of code! If it's good code then it will use Excel to do some of the work, but the C# won't have the Excel object model so it won't work any more. If it's not good code then it might do it all without Excel, but then why would you want to port bad code?
nocache
+1 BBQ? My rep score didn't move.
Mitch Wheat
A: 

Try using FlexCel.NET from www.tmssoftware.com/site/flexcelnet.asp and they also have non-commercial version.