Free Support Forum - aspose.com

Aspose.Cells VbaProject

I have several vba scripts that I am adding to the Aspose.Cells Workbook.VbaProject.Modules collection. These scripts require references to other DLL’s such as:

  • Microsoft Office 15.0 Object Library
  • Microsoft Forms 2.0 Object Library
  • Microsoft Scripting Runtime
From within Excel, I can add these through the VBA IDE by ticking their checkboxes in the References window.


How can I add them programmatically? Is there a VBA reference collection that I can add them to?

Thanks

Hi,

Thanks for your posting and considering Aspose.Cells.

This is the proper way of adding reference to .NET assemblies. You cannot add them in any other way. However, you can research System.Reflection APIs which will enable you to load assemblies dynamically through code instead of statically as you have shown in the screenshot.

Please remember Aspose.Cells.VbaProject namespace is not the counterpart of VBA. It just helps you manipulate/inject/write VBA code using Aspose.Cells API. It is in very initial stages. Please check the following article that explains their usage.

( http://www.aspose.com/docs/display/cellsnet/Modifying+VBA+or+Macro+Code+using+Aspose.Cells )

Thanks for your reply, but I do not think loading DLL’s dynamically within the Excel script is going to be feasible.

For an example of what I am talking about, there is a freeware package, EEPlus that has this functionality.
You can see what I am talking about at:
http://epplus.codeplex.com/SourceControl/latest#EPPlus/VBA/ExcelVBAReference.cs

Hi,

Thanks for your posting and considering Aspose.Cells.

Please provide us your sample code (project) so that we could better understand your requirements. Please let us know how Aspose.Cells fits in your current problem. What are you going to do with Aspose.Cells Workbook.VbaProject.Modules collection? The sample code will give us the good idea of your issue. Thanks for your cooperation.

Please also see if your issue is related to this thread.

( http://www.aspose.com/community/forums/permalink/657612/657612/showthread.aspx#657612 )