Sie sind auf Seite 1von 10

The Spreadsheet Guru

be the expert in your o ce

HOME ABOUT BLOG VBA VAULT STORE CONTACT

a tep--tep Intruction To Create Your Firt


xcel Rion Add-in
Ma 30, 2015 Chri Newman

JUT LAUNCHD!

Create xcel, PowerPoint, Word add-in with eae with thi


revolutionar template and online coure!

FAVORIT ADD-IN & ARTICL


One of the mot properou kill I have picked up over the ear a a financial analt ha een the ailit to
create cutom xcel add-in pecific to m department and compan' need. Thi one kill I have een ale to
provide to m compan ha aved numerou people time, frutration, and mone. While it took me well over a ear
to teach melf how to create top-notch add-in, I want to let ou in on a little ecret....it' reall NOT THAT HARD!
And toda I want to hare with ou jut how ea it can e to uild an xcel add-in that look amazing and will
provide tremendou value to our compan a well a to our profeional career.

JUT LAUNCHD!

Check out the M Firt Add-in template + Online Coure which include template
with man more Rion capailitie than the one availale in thi article (include
xcel/PowerPoint/Word verion) and alo a 6 module online video coure to teach
ou how to cutomize the Rion outide of the template.

In thi article, I will walk ou through 5 imple tep:

tep 1: Download m free template (I have done all the difficult, nerd tuff for ou in thi file)
tep 2: Link our macro and macro decription to the Rion utton
tep 3: Tet our utton and make ure the work
tep 4: Chooe the icon ou want to dipla (Microoft provide thouand for free!)
tep 5: ave our template a an add-in file and intall/hare

And Look What You Can Create!

LATT VA COD ARTICL

Turn Off Pivot Tale Autofit


Column Width On Update
etting
3 WK AGO

wap Two elected Cell


Range In xcel
3 MONTH AGO

Don't how Update xternal


Link Dialog While Opening
File With VA
4 MONTH AGO

tep 1: Download The Template


FR WINAR
I went ahead and did all the trick tuff for ou and et up a template to give ou a great head tart. You can
download thi template  clicking the utton elow and igning up for m tip email newletter. Once igned up,
ou will intantl gain acce to the private wepage where ou can download the template. Thi will allow ou to
kip all the difficult Rion coding.

Alread ucried? Click HR to log-in to the "xample File" ection


POPULAR LOG POT

After ou've filled out the ign-up form, go check our email inox and ou hould have two email, one aking for a tep--tep
confirmation to the Guru Newletter and the other with a link to download the template ou will need to complete Intruction To Create Your
the ret of thi tutorial. Open thi file and move on to tep 2! Firt xcel Rion Add-in
4 YAR AGO

tep 2: Link Your Macro


The VA Guide To xcel Pivot
Tale
Once ou've received and opened our rand panking new xcel Rion template, let' dig into the VA and link all
5 YAR AGO
our macro code nippet o the can e triggered  our Rion utton. I am going to run through an example
where I want to create a rion with jut one macro utton. efore we egin, make ure ou have the file open and
5 Different Wa to Find The
are looking at the Viual aic ditor (hortcut ke Alt + F11).
Lat Row or Lat Column
Uing VA
1. Hide Unued Group & utton 5 YAR AGO

ince I onl want to create an add-in with one utton and the template hold 50 utton, I am going to want to hide
Cop & Pate Multiple xcel
the other 49 utton. To do thi, I need to navigate to the Rionetup module and then down to the GetViile
Range To eparate
uroutine. You hould ee a Cae tatement that goe through each utton name (ie mutton#) and tell the
PowerPoint lide With VA
Rion whether to how the utton (True) or hide it (Fale). ince I onl want one utton howing in the example, I'm
5 YAR AGO
going to make onl the firt utton (mutton1) have a value of True.

 Now ince the utton are ectioned off into group, I can jut make the entire group not viile  modifing the
144 Cae tatement dealing with group ID. In the example elow I how Group not eing viile.

 Follow @ChrisMacro


The Spreadsh…
 2.2K likes


Like Page

Be the first of your friends to like this

Click to enlarge

2. Add Your Macro Code

Next, let' add our macro code. I'm jut going to ue a imple piece of code that doe the Patepecial command
"Pate Value Onl" with the data currentl copied to the clipoard.

1. Navigate to the Macro module and pate in our macro code.


2. Go ack to the Rionetup module and croll to the RunMacro uroutine

3. Add the macro name to the correponding utton name (overwriting the DummMacro name)

Click to enlarge

3. Add A creentip For Your Macro

A great wa to help our uer or ourelf rememer what a utton doe i to include a creentip. A creentip i a
rief decription that remind the uer what a utton doe while hovering over it. You ee creentip all the time in
the normal Rion ta, ut ou ma have never noticed them. Go ahead and hover over a utton on our Home ta
and ou'll ee ome example.

Click to enlarge

4. Add Your Ta, Group, & utton Name To The Rion UI

To finih off thi ection we are going to go down to the GetLael uroutine within the Rionetup module. imilar
to adding a creentip, ou can add a cutom lael via thi macro that will dipla eneath our utton on the Rion.

For thi example, let' call our Ta "Compan", our group "Patepecial", and the utton "Pate Value". A hown
elow, all we need to do i navigate to the GetLael uroutine and modif the Laeling variale value to equal the
text value we want diplaed on the Rion ta.

Click to enlarge

At thi point, we have linked our macro to a utton, we've laeled the utton, and provided a creentip o our uer
know what the utton doe. The major etup piece are complete. Let' move on to tep 3!

tep 3: Tet Your utton


Thi i a rief tep ut a ver important one. After ou have linked all our macro to the utton on our Rion, ou
will want to ave our file and cloe out of it. Re-open the file and ee if all our etting tweak actuall flowed into
the Macro ta (or in thi example the Compan ta). Alo, tart teting our macro to make ure the are all
linked to the proper utton and running a expected.

tep 4: Chooe Your Icon


Next, i one of m favorite tep when deigning a new add-in, picking out the icon! You might e wondering, how
much mone am I going to have to pend to get ome nice looking icon for m add-in? Well luck for u, Microoft
ha een graciou enough to give everone complete acce to all of their fanc icon ued throughout the Office
uite.

o how do we get thee aweome icon? Well, rememer all that work I did for ou to create our hand tarting
point template? You don't have to worr aout finding the icon at all. All ou need to do i tell Microoft which
icon to ue  tping out their name in our VA code. Jut navigate to the GetImage uroutine and enter in the
icon name with the repective utton line. ince our example macro deal with pating, I am going to ue the
PateValue icon.
Click to enlarge

How Do You Get The Icon Name?

There are a few reource out there that have the Rion icon name, ut I peronall prefer the xcel file Microoft
created called Office 2007 Icon Galler. Thi file dipla all the icon image in 9 gallerie up in the Developer ta
of the Rion. If ou hover over an image, the image' name will appear in the creenTip ox. You will need to cop
thi name veratim (it i cae enitive!) and add it into the VA macro called GetImage(), in the repective "cae"
ection. elow i how I found the Page reak icon name.

Let me a it again: the icon name I CA NITIV! o make ure ou capitalize the correct character.

Click to enlarge

How Do You Change The Icon ize?

A ou ma have noticed when ou firt opened up the template file, not all the icon are the ame ize. There are
two availale ize that Microoft allow ou to make our icon (large or mall). The ize of what our icon will e
i completel up to ou. You ma want to make important or heavil ued icon large, while making other icon mall
to ave pace.

To change the ize of an icon, navigate to the Getize() uroutine and impl change our repective utton to
either equal Large or mall.

You will need to ave our file and re-open it to implement the change.

Click to enlarge

tep 5: ave File A An Add-in


The lat tep i to ave the file a an add-in file. xcel add-in file have a file extenion of ".xlam", o make ure ou
elect that extenion tpe when ou are aving. After ou have aved our add-in file, ou can cloe our xcel
template (the .xlm file) and intall our lovel new add-in! If ou don't know how to intall an add-in, ou can check
out m How to Intall a VA Add-in pot that will teach ou how to do thi.

Congratulation, You Have Developed Your Firt Add-in!


You're all done! In jut 5 imple tep, ou were ale to create an aweome and ver profeional-looking Rion-
aed add-in that ou can ue for ourelf, our team, or even our entire compan. Hopefull, I wa ale to how
ou that creating add-in in't rocket cience ut mot people don't know that. Ue thi to our advantage and ue
our new learned kill to impre our o or even our o' o! If ou don't mind haring, I'd love to ee how
our add-in turned out. Feel free to pot a creenhot of what ou were ale to create in the comment ection
elow!

Want More Feature? Check Out M Firt Add-in

In 2018, I created a more rout add-in creator template that include the following:

• Over 150 utton

• xcel, PowerPoint, Word verion


• plit utton
• Menu utton (with up to 12 u-utton)

• Dialog Launcher
• creentip/upertip
• Online Video Coure

LARN MOR

 122 Comments 11 Likes Share


 Excel, VBA
 Add-Ins, RibbonX

 THE VBA GUIDE TO INTERACTING WITH ... ONLINE EXCEL & VBA BLOG RESOURCES 
Affiliate Program | About | Example Files

Guru Solutions, LLC | © 2015-2019 | ALL RIGHTS RESERVED


Excel, PowerPoint, Word, & the rest of the Office Suite are registered trademarks of the Microsoft Corporation
This site is not affiliated with Microsoft Corporation.

Das könnte Ihnen auch gefallen