Method to run vba code

SmallFry
StarLounger
Posts: 91
Joined: 02 Sep 2018, 23:12

Method to run vba code

Post by SmallFry »

I'm fixing multiple documents by running multiple codes which right now I linked together with a Call. This works fine, but there are other pieces of the code I would like to hand select and run.

So my method now, open the VBE and manually run the VBA procedure I chose. I sometime might even use the Alt + F8, select, and run. I've also occasionally used a customized toolbar, but that's usually built in specifically to one document, not the document I'm trying to cleanup.

Looking for some ideas about how I could attack this. Is there anyway to import a ribbon or an add-in so I have all of the VBA procedures in the word document itself and can now point and click? I hope that makes sense.

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Method to run vba code

Post by HansV »

You could store all macros in one document, and save that as a macro-enabled template (.dotm) in Word's startup folder (by default C:\Users\<username>\AppData\Roaming\Microsoft\Word\STARTUP). The template will then automatically be loaded as an add-in, so that the macros are always available.

You could create custom Quick Access Toolbar buttons for selected macros, or create a userform in the template with command buttons that run macros.
Best wishes,
Hans

SmallFry
StarLounger
Posts: 91
Joined: 02 Sep 2018, 23:12

Re: Method to run vba code

Post by SmallFry »

Sorry for the delay. I can't log in from work.

Thank you very much. I went with the macro-enabled template (.dotm) in Word's startup folder and then built a user form. Now to add all those macros to the form. :thankyou:

SmallFry
StarLounger
Posts: 91
Joined: 02 Sep 2018, 23:12

Re: Method to run vba code

Post by SmallFry »

Hi Hans,

With your help so far, I have been able to capture some routine macros I need to run to clean up my documents. Curios, do you know of a place to go to find a collection of various other VBA routines that might be useful in cleaning up a word document? I know that's open ended, but anything to look over as a reference would be great.

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Method to run vba code

Post by HansV »

I don't, but let's see if others will have suggestions for you.
Best wishes,
Hans


SmallFry
StarLounger
Posts: 91
Joined: 02 Sep 2018, 23:12

Re: Method to run vba code

Post by SmallFry »

Thank you Charles

User avatar
Charles Kenyon
4StarLounger
Posts: 596
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Method to run vba code

Post by Charles Kenyon »

You are welcome.