Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

Excel VBA: share procedures / macros with users

Hello experts,

I have multiple vba procedures which I would like to share with final users so they can re-use it when they open excel application. I was wondering what is the best way to automatically share with them those procedures. I was thinking to add all those procedures into an add-in file and then share the file however I don’t know if it is the best way.

Thank you very much for your feedback.
Avatar of Norie
Norie

Using an add-in is probably the best way, though you might need to rewrite some of the code to ensure it targets the correct workbook.
Avatar of Luis Diaz

ASKER

All the procedures are related to activesheet so I will not have issue with this. Experts: is it possible to share a script example that allows to automatically add procedures in excel application?
All the procedures are related to activesheet so I will not have issue with this.
Highway to hell !!
What if the user click on another worksheet ?
What if the user click on another workbook ?

10 bucks your code will fail.
When writing code for an addin you cannot code a workbook name or a worksheet name when writing the code. Therefore, it is necessary to use ActiveWorkBook or ActiveSheet. You can add a check asking the user if the correct sheet is activated or  if the there is a naming convention for the sheets to use, e.g. "Timesheet April", then something like

If Left(ActiveSheet.Name, 9) = "TimeSheet" Then
''code here
Else: MsgBox "Are you sure the correct sheet is activated?"
End If

Open in new window

Thank you very much for your help.

the question  here is to find a way to: share procedures with other users and add those procedures in excel tool bar. Is there way to do this automatically through vba?
Make a wokbook holding your VBA functions or an access database, and reference it.
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Roy, great links! Thank you very much for sharing!
Pleased to help.