If you're talking about the script inside Excel itself, that's VBA,
not VB.NET.  VBA is unrelated to .NET - just a slightly similar syntax
to VB.NET.  There is no C# equivalent, so you're stuck with VBA.

But if you want to work with Excel from .NET, you can do that through
Interop - in this case, you're probably better off with VB.NET than C#
anyway...The big advantage for VB.NET with Excel is that VB.NET allows
optional parameters - the Office functions have tons of them.  When
using C#, you must fill in all of the unused parameter values with the
value Type.Missing - this has the same effect as using VB.NET and
leaving off those optional parameters.

So you'll end up writing code like:
// C#
Workbook workBook = app.Workbooks.Open(filename, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);

instead of:
' VB
Dim workBook As Workbook = app.Workbooks.Open(filename)

I believe C# 4.0 will allow optional parameters, so this shouldn't be
an issue once that's out.

On Feb 17, 4:50 pm, Mandragon <[email protected]> wrote:
> I am wondering if I can use C# instead of VB to program inside excel.
> I only see a VB editor when I look in the developer tab.
>
> Thanks for your time!

Reply via email to