Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel VBA to C#

Tags:

c#

excel

vba

I am converting some codes from Excel VBA to C# and run into this problem. I am not sure the equivalent of this code in c#. Intellisence wasn't very helpful :(

Selection.ShapeRange.Adjustments.Item(1) = 90

I managed to get as far as Adjustment in c# but there is no Item property.

like image 784
Keylee Avatar asked Mar 27 '15 01:03

Keylee


People also ask

Can you convert VB to C?

The VB to C# code converter from the SharpDevelop team is now a standalone extension to Visual Studio. Once installed, you can convert an entire VB.NET project to C# by opening the solution, right clicking the solution node in the Solution Explorer and selecting Convert to C#.

Is VBA written in C?

Released in 1996, it is written in C++ and became an object oriented language. VBA 5.0 was launched in 1997 along with all of MS Office 97 products.

Can Excel macros be written in C#?

You can try my ESharper add-in to write an Excel automation command in C#. It is easier than creating a separate C# application or an add-in, and you will have access to both Excel object model and Excel C API with more options for performance optimization.


Video Answer


1 Answers

Per MSDN it seems the Adjustments property has an indexer, so you could do this:

Selection.ShapeRange.Adjustments[1] = 90;
like image 168
Mathieu Guindon Avatar answered Oct 23 '22 15:10

Mathieu Guindon