Hi

I have created a code to create excel macro in C#.But while trying to create a new VBA code module i am getting a error.The code that i have used is

module = excelWorkbook.VBProject.VBComponents.Add(VBIDE.vbext_ComponentType.vbext_ct_StdModule);

this part of the code is throwing an error.

Error 1 The best overloaded method match for 'Microsoft.Vbe.Interop._VBComponents.Add(Microsoft.Vbe.Interop.vbext_ComponentType)' has some invalid arguments

Error 2 Argument '1': cannot convert from 'VBIDE.vbext_ComponentType' to 'Microsoft.Vbe.Interop.vbext_ComponentType'

thanks in advance

i have referred to both the links before posting the thread. If you look in you will see that they have used the same syntax.But my code won't compile

Edited 6 Years Ago by carobee: n/a

We talk about functions of Excel in our daily routine. One of the millions of functions of Excel is “Macros”. When you turns the Macros “on”, it starts recording whatever is being done in particular excel sheet. So you can get to know about the work done by your co workers on one Excel Sheet in your absence. Moreover, it can also be used for security purpose. In fact you can use Macros in as many ways as your imagination allows you. Complete MS Excel Macro Training material can be downloaded by clicking on the following mentioned link

http://uptodatearticles.com/2010/10/excel-macro-training/

This article has been dead for over six months. Start a new discussion instead.