We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is Aspose.Cells support macros now?

I wanna copy a sheet with two buttons and macros, with Aspose.Cells 4.1, I got a wookbook that Microsoft Excel said it was broken.

is it possible to do this with Aspose.Cells now?

thanks

T.

Hi,

Thanks for considering Aspose.

I think you are using Worksheet.Copy() method. Please use Workbook.Copy method. Worksheet.Copy method doesn't preserve VBA for we cannot seperate VBA code. We only support to copy them as a whole. After copying the whole workbook, you may remove your unwanted worksheets.

E.g., Suppose, the workbook has three sheets and the source sheet is the second sheet which has buttons with vba macros.

Workbook workbook = new Workbook();

workbook.Open("d:\\test\\book1.xls");

Workbook wkb = new Workbook();

wkb.Copy(workbook);

wkb.Worksheets.RemoveAt(0);

wkb.Worksheets.RemoveAt(2);

wkb.Save("d:\\test\\outbook1.xls");

And Kindly use the latest version 4.3.

Thank you.

Thanks

and now i have to create Excel file that have variable number of the sheet with buttons and macros, so i can't create the template with all sheet i need.

could i add buttons in sheet with Aspose.Cells and link it to the macros which already in the workbook?

thanks a lot

Hi,

We do not support to create or manage vba macros although you can create a button control using Aspose.Cells APIs.

Thank you.

well, then i have to built an add-ins for excel to do so.

thank you and wish new functions

@Teaks,

Aspose.Cells now supports to create, manipulate, assign macros to controls or remove vba codes/macros to the next level with enhancements.

See the documents in the section on how to manage/manipulate VBA code and macros via Aspose.Cells APIs:
Manipulate Macros or VBA Codes

The latest versions of the product are available here:
Aspose.Cells for .NET (Latest Version)

You can also download the latest demos here.