We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to Attach a Macro Module

Thread ID:

Created:

Updated:

Platform:

Replies:

89939 Sep 10,2009 11:26 AM Sep 15,2009 12:51 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Senthil Kumar
Asked On September 10, 2009 11:26 AM

Hi,

i have an excel sheet which contains macros in 3 modules, when i try to copy all the worksheets to another workbook the modules are not copied. Can u provide me code snippet to perform this?

Many thanks

Senthil kumar K.

Geetha M [Syncfusion]
Replied On September 15, 2009 12:51 AM

Hi Senthil,

The macros are stored in the workbook and they won't be copied when each worksheets are copied. You may need to generate a new workbook from the existing one.

IWorkbook workbook = application.Workbooks.Open(@"..\..\TestSample.xls");
workbook.SaveAs("Sample.xls");
workbook.Close();
excelEngine.Dispose();

Please try this and let me know if you have any questions.

Regards,
Geetha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;