macro Excel

Jul 22, 2012 at 10:25 PM

Hi Sebastian,

first, thank you for this great library

i would like to know if it's possible to create a macro directly in Excel with your library ? And is it possible to create a button for a specific sheet.

What i want is after when i open the file, i want to have my sheet whith my data and a button on it. When i click the button, the macro is launched.

i have not found some example. Is it possible to do this with the libray

thanks again

Fred

Coordinator
Jul 23, 2012 at 6:48 AM
Edited Jul 23, 2012 at 6:48 AM

hey fred,

the first one: NetOffice is a full/plain wrapper. if you can do it with VBA or the Interop Assemblies then you do it also with NetOffice in the same way.

did you know the dynamic VBA code example?

CS: http://netoffice.codeplex.com/wikipage?title=Excel_Example07
VB: http://netoffice.codeplex.com/wikipage?title=Excel_Example07_VB

which kind of button you want? a context menu button, ribbon or classic button or a button in the worksheet?

Sebastian

Jul 23, 2012 at 9:16 AM

Hi,

i saw the example 7 (cs) and tried it. The Excel file is generated but when i open the vba editor, there is no code (no module 'MyNewCodeModule' added).

So the DoubleClick event doesn't work too!

What i want is a simple button (no ribbon because Excel 2003 can be used). I don't know the difference between a 'classic button' or a 'button in the worksheet'

I want to launch the vba code from the click event of this button

 

i'm using the official release (v1.4.1)

thanks

Fred

Jul 23, 2012 at 9:17 AM

i have forgotten to say that i'm using office 2007 SP2

Coordinator
Jul 23, 2012 at 10:02 AM

hey fred,

please try the 1.5.1 release, its much better. excel 2007 and higher have new security features. one of these features is you have to use the file extension .xlsm for files with attached vba code. one of the examples mistakes in the 1.4 release. rename your file to <Name>.xlsm and your code is available.

a classic button is just what you say. its a button in the (classic) menu from excel. a button in the worksheet is a button in the cell range hosted from the worksheet and not from the whole applications. this is what you want right?

Sebastian