Skip to main content

These steps are done using Office 2010 (except where noted otherwise) but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer barDeveloper tab to the ribbon.

In Office 2007,

  1. Click “Office Menu” -> “(Program) Options”.  (“Office Menu” refers to the Office button button in the top left corner.) This brings up a menu that has an “Excel Options”, “Word Options”, etc., button at the bottom.

  2. In the options dialog box, check “Show Developer tab in the Ribbon”: Office menu and click “OK”.

  3. Your new “Developer” tab should be showing.

In Office 2010 and 2013,

  1. Click File -> Options.

  2. Choose Customize Ribbon.

  3. On the right side, find Developer and check the box. Click OK.

  4. Your new tab should be showing, click on it and then click on Visual Basic.

A daunting screen is shown, which is the VBA code editing window.

Side note: You can also open the VBA code editing window by using the Alt+F11 keyboard shortcut (even if the Developer tab is not showing).

Inside the code editing window, on the left side you should have a pane called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word, Outlook, etc.) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is show open a dialog box to show a message on-screen.

Copy the code, and paste it into the white sheet in the VBA code editing window.

Now, at the top of the VBA code editor window, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'subroutine'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the Developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it'sits appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like ThisWorkbook.WarnMeOfDanger. Click on this and click OK.

Now, if you press your new button, the message will show. Right-click the button to get options to move it, change the text, resize etc.

These steps are done using Office 2010 but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer bar to the ribbon

  1. Click File -> Options.

  2. Choose Customize Ribbon.

  3. On the right side, find Developer and check the box. Click OK.

  4. Your new tab should be showing, click on it and then click on Visual Basic.

A daunting screen is shown, which is the VBA code editing window.

Side note: You can also open the VBA code editing window by using the Alt+F11 keyboard shortcut (even if the Developer tab is not showing).

Inside the code editing window, on the left side you should have a pane called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word, Outlook, etc.) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is show open a dialog box to show a message on-screen.

Copy the code, and paste it into the white sheet in the VBA code editing window.

Now, at the top of the VBA code editor window, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'subroutine'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the Developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it's appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like ThisWorkbook.WarnMeOfDanger. Click on this and click OK.

Now, if you press your new button, the message will show. Right-click the button to get options to move it, change the text, resize etc.

These steps are done using Office 2010 (except where noted otherwise) but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the Developer tab to the ribbon.

In Office 2007,

  1. Click “Office Menu” -> “(Program) Options”.  (“Office Menu” refers to the Office button button in the top left corner.) This brings up a menu that has an “Excel Options”, “Word Options”, etc., button at the bottom.

  2. In the options dialog box, check “Show Developer tab in the Ribbon”: Office menu and click “OK”.

  3. Your new “Developer” tab should be showing.

In Office 2010 and 2013,

  1. Click File -> Options.

  2. Choose Customize Ribbon.

  3. On the right side, find Developer and check the box. Click OK.

  4. Your new tab should be showing, click on it and then click on Visual Basic.

A daunting screen is shown, which is the VBA code editing window.

Side note: You can also open the VBA code editing window by using the Alt+F11 keyboard shortcut (even if the Developer tab is not showing).

Inside the code editing window, on the left side you should have a pane called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word, Outlook, etc.) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is show open a dialog box to show a message on-screen.

Copy the code, and paste it into the white sheet in the VBA code editing window.

Now, at the top of the VBA code editor window, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'subroutine'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the Developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean its appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like ThisWorkbook.WarnMeOfDanger. Click on this and click OK.

Now, if you press your new button, the message will show. Right-click the button to get options to move it, change the text, resize etc.

cleaned it up a bit, added hte Alt+F11 note, and changes the word "function" to "subroutine" as a "Function" is actually a different thing.
Source Link
Ƭᴇcʜιᴇ007
  • 113.2k
  • 19
  • 203
  • 270

These steps are done using OutlookOffice 2010 but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer bar to the ribbon

  1. Click FileFile -> OptionsOptions.

  2. Choose Customize RibbonCustomize Ribbon.

  3. On the right side, find DeveloperDeveloper and check the box. Click OKOK.

  4. Your new tab should be showing, click on it and then click on Visual Basic.

Your new tab should be showingA daunting screen is shown, click on and then click on Visual Basicwhich is the VBA code editing window.

A daunting screenSide note: You can also open the VBA code editing window by using the Alt+F11 keyboard shortcut (even if the Developer tab is shownnot showing). On

Inside the code editing window, on the left side, you should have a windowpane called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word/Outlook, Outlook, etc.) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is showsshow open a dialog box to show a message on screen-screen.

Copy the code, and paste it into the white sheet in the Visual Basic screenVBA code editing window.

Now, at the top of the Visual Basic screenVBA code editor window, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger()WarnMeOfDanger(). This is actually the name of our 'function''subroutine'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the developerDeveloper ribbon, click on InsertInsert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it's appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like "ThisWorkbook.WarnMeOfDanger"ThisWorkbook.WarnMeOfDanger. Click on this and click OKOK.

Now, if you press your new button, the message will show. Right click-click the button to get options to move it, change the text, resize etc.

These steps are done using Outlook 2010 but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer bar to the ribbon

  1. Click File -> Options.

  2. Choose Customize Ribbon

  3. On the right side, find Developer and check the box. Click OK.

Your new tab should be showing, click on and then click on Visual Basic.

A daunting screen is shown. On the left side, you should have a window called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word/Outlook etc) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is shows a message on screen.

Copy the code, and paste it into the white sheet in the Visual Basic screen.

Now, at the top of the Visual Basic screen, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'function'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it's appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like "ThisWorkbook.WarnMeOfDanger". Click on this and click OK.

Now, if you press your new button, the message will show. Right click the button to get options to move it, change the text, resize etc.

These steps are done using Office 2010 but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer bar to the ribbon

  1. Click File -> Options.

  2. Choose Customize Ribbon.

  3. On the right side, find Developer and check the box. Click OK.

  4. Your new tab should be showing, click on it and then click on Visual Basic.

A daunting screen is shown, which is the VBA code editing window.

Side note: You can also open the VBA code editing window by using the Alt+F11 keyboard shortcut (even if the Developer tab is not showing).

Inside the code editing window, on the left side you should have a pane called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word, Outlook, etc.) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is show open a dialog box to show a message on-screen.

Copy the code, and paste it into the white sheet in the VBA code editing window.

Now, at the top of the VBA code editor window, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'subroutine'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the Developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it's appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like ThisWorkbook.WarnMeOfDanger. Click on this and click OK.

Now, if you press your new button, the message will show. Right-click the button to get options to move it, change the text, resize etc.

Source Link
Dave
  • 25.4k
  • 11
  • 59
  • 70

These steps are done using Outlook 2010 but should be similar enough for 2007 and 2013 as well. I'm doing it with Excel but the differences should be subtle.

The first step is to add the developer bar to the ribbon

  1. Click File -> Options.

  2. Choose Customize Ribbon

  3. On the right side, find Developer and check the box. Click OK.

Your new tab should be showing, click on and then click on Visual Basic.

A daunting screen is shown. On the left side, you should have a window called Project-VBAProject. In this, under the Microsoft Excel Objects (this name is different depending on which program (Word/Outlook etc) you are using) is a 'thing' called ThisWorkbook. Double click on ThisWorkbook

In this example, we'll use the following code.

sub WarnMeOfDanger()
   MsgBox "Argh, a dragon is behind you!"
end sub 

All the above does is shows a message on screen.

Copy the code, and paste it into the white sheet in the Visual Basic screen.

Now, at the top of the Visual Basic screen, click the green play button and you should see a message.

So, every time you want to run the code, return to this screen and press play!

However, you may prefer to add your own button. If you want to add a button then, first, note the first line of the code has WarnMeOfDanger(). This is actually the name of our 'function'. We'll remember this for later. Now, simply close the Window you've been using (the code is automatically saved).

Still in the developer ribbon, click on Insert, and choose the first item, which is a button. Your mouse cursor becomes a little cross (not angry, I mean it's appearance). Draw the size of the button. A new window appears, and it should show us the option to assign the button to a function. In this case, we should see something like "ThisWorkbook.WarnMeOfDanger". Click on this and click OK.

Now, if you press your new button, the message will show. Right click the button to get options to move it, change the text, resize etc.