Reputation: 8538
I have a VBA function which I would like to use in my Excel file.
The Excel file is created via Matlab, and I would like to use the VBA function in a cell in one of the Excel sheets.
I could create a VBA function manually within the Excel file. However, since I am creating the Excel file through a program, I would like to save the VBA function as a file and then call it from Matlab.
Is there a way to use the VBA function in the Excel file?
Upvotes: 1
Views: 700
Reputation: 1820
Save your VBA project as an Excel Add-In (File > Save as... "Excel Add-In (.xlam)"). Make sure that the Add-In is loaded in the Add-Ins dialog (see here). This Add-In will be loaded with Excel and available for every workbook opened on this computer. However, if you share your workbooks with other users, the custom VBA functions from your Add-In will not be available to them.
Upvotes: 1