PDA

View Full Version : Calling functions and subs from another file



Xanthopteryx
05-11-2019, 12:55 AM
Hi.

Having a lot of power point macros that clips in images and other stuff. All of them have a lot of functions and subs to do stuff (like comparing files, getting the newest file, aligning and so on) so the main code will be more easy to handle and maintain for some people not so into the VBA code.
This works great, but - if i wan't to update the subs and functions, i have to put the the updated code in EVERY macro and that is a pain in the ---.
So, is it possible to have the macro calling the functions from another file (like "Reference_Macro.whateverisneeded") so all the updates goes into that single file instead?

I can't install special software and that kind of stuff (at work you know...).

If this is possible, how do i implement this?

Regards X.

John Wilson
05-13-2019, 04:25 AM
The best way to do this is to write a ppam AddIn with ribbon controls that make it available to all users.

You can though call code in other open presentations using

Application.Run ("the name of the code sub routine")

Xanthopteryx
05-13-2019, 04:44 AM
The best way to do this is to write a ppam AddIn with ribbon controls that make it available to all users.

You can though call code in other open presentations using

Application.Run ("the name of the code sub routine")

Thank you.

The ribbon AddIn, how does that work?

Regards X.

John Wilson
05-13-2019, 06:59 AM
There is a very basic tutorial on our site but there is a learning curve.

Although it's for 2007 it also works the same in later versions.

http://www.pptalchemy.co.uk/custom_UI.html