Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB code for running a macro rcc Excel Discussion (Misc queries) 3 January 23rd 08 02:53 AM
Automatically running code Richard Excel Worksheet Functions 1 February 7th 06 09:35 PM
running code mark New Users to Excel 3 March 14th 05 09:14 AM
Running Code Automatically Bruno[_2_] Excel Programming 2 January 31st 04 06:26 AM
running VB code Cath[_3_] Excel Programming 1 November 21st 03 05:09 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"