I use aspose.cell dll to copy a worksheet which has a command button and
associated vba code. Command button doesn’t work in the new worksheet?
Why? How can I fix that? Thanks.
Workbook wb = new Workbook(“Sample.xls”);
Worksheet sheet= wb.Worksheets[0];
sheet.Cells[“B10”].PutValue(“test”);
Worksheet cpySheet = wb.Worksheets[wb.Worksheets.AddCopy(0)];
wb.Save(“Sample.xls”);
sheet[0] has a command button and vba code, but it doesn’t work in cpySheet.
Hi,
Thanks for you quick reply.
I hope the command can be clicked and the vba also works on the copied sheet. Thanks a lot.
Amjad Sahi:Hi,Thanks for the sample file and code.I can notice the issue as you have mentioned. The command cannot be clicked on the copied sheet.I have logged a ticket with an id "CELLSNET-41356" for your issue. We will investigate your issue and get back to you soon.Thank you.
Hi Sahi,
Is there any update on this? We are waiting this fix to release our project. Thanks.
Hi,
Hi,
Amjad Sahi:Hi,To update you on your issue, we have completed our investigation and analysis. We regret to tell you that we may not support it or fix your issue. The main reason is that we do not support parsing VBA codes (already logged a ticket as "CELLSNET-40353") at the moment, so we cannot support this feature.We are sorry for any inconvenience caused!
Hi Sahi,
If worksheet count is dynamical, is there any workaround to resolve this? I need all added worksheet has a command button and corresponding VBA code. Thanks.
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
It seems your requirements will not be supported because Aspose.Cells cannot manipulate the VBA or macros.
Anyway, we have logged your comments in our database. Once, there is some update for you, we will let you know asap.
Hi,
Hi,
Using Aspose.Cells, I am trying to Create copy of a worksheet in same workbook. The source Worksheet is having a button control and a macro is assigned to this button.
When I create a copy of source work sheet, all the data and button controls are copied into second worksheet in same work book. But macro assignment is not happening for the button in second sheet. Could you please help me out on how to assign macro code to the button using Aspose.Cells for .Net.
Thanks,
Valli
Hi Valli,
Hi Sahi,
Thanks for your quick reply.
Please find attached SampleTemplate and the code below.
string filepath = @"D:\\Aspose\\SampleTemplate.xlsm";
Workbook wb = new Workbook(filepath);
wb.Worksheets.Add("Sheet2");
wb.Worksheets["Sheet2"].Copy(wb.Worksheets["Sheet1"]);
wb.Save("D:\\Aspose\\SampleTemplate.xlsm", SaveFormat.Xlsm);
When we copied the worksheet in the same workbook manually the macro assignment is retained.
Please let me know if you need any further information.
Thanks,
Valli
Hi Valli,
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
We have supported copying VBA code when copying a worksheet to other worksheet in
a workbook.
Please download and try this fix: Aspose.Cells for .NET v7.5.3.1.
The issues you have found earlier (filed as CELLSNET-41356) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.