Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code from Add-Ins
I have a spreadsheet which I send to 260 people which is read-only (for them)
call it MASTER and I have functions which only I as Admin of MASTER need to perform on the sheet. To try to minimise the size of the sheet I decided to seperate the admin functions to an ADD-IN (say ADMIN.XLA). I have created the add-in and a menu to call the functions but the only way I could find to get the SUBS in ADMIN.XLA to run (from the add-in menu) when working in MASTER was to create a reference in the original s/sheet from the VBE. It seems to work ok and the MASTER still works OK for users and myself but have I achieved anything? It's no smaller! Have I gone wrong with my ADD-IN? It is my first! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running Code from Add-Ins
Depending on what your xla does (not clear in your post) there are various
ways to use it, eg- UDF (worksheet function) - Ctrl-F3, scroll down in function category to "User defined" and you should see your functions in the right panel. Use in the normal way. Apart from the code involved you won't notice any difference in file size as relates to the sheet. To call a Sub in your xla from code in your workbook module - Application.Run "MyAddin!myMacro" (might need to embrace the addin name with apostrophe's). From a "Forms" button's OnAction assign the macro as above (without quotes). Change the xla project name from VBAProject to something unique and set a reference to it in the workbook (Tools, Ref's). Then simply run the sub or function from some macro in your workbook as if it were in the workbook - in the workbook Sub Test() someAddinMacro someAddinProc arg1, arg2 End Sub Do not head xla modules with "Option Private Module" for anything you want accessed from elsewhere. From the open event of your addin, install menu items, & remove when the addin unloads or un-installs. Regards, Peter T "DeanO" wrote in message ... I have a spreadsheet which I send to 260 people which is read-only (for them) call it MASTER and I have functions which only I as Admin of MASTER need to perform on the sheet. To try to minimise the size of the sheet I decided to seperate the admin functions to an ADD-IN (say ADMIN.XLA). I have created the add-in and a menu to call the functions but the only way I could find to get the SUBS in ADMIN.XLA to run (from the add-in menu) when working in MASTER was to create a reference in the original s/sheet from the VBE. It seems to work ok and the MASTER still works OK for users and myself but have I achieved anything? It's no smaller! Have I gone wrong with my ADD-IN? It is my first! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VB code for running a macro | Excel Discussion (Misc queries) | |||
Automatically running code | Excel Worksheet Functions | |||
running code | New Users to Excel | |||
Running Code Automatically | Excel Programming | |||
running VB code | Excel Programming |