The tutorials on VBA will include both videos and text. If you have feedback on either, please leave a post on our Forum or send us a mail.

Page content

Hello World

Our first encouter with VBA will be to display the familiar "Hello World" message.

  1. Choose the "Developer" tab and open the VBA editor. If you don't locate the "Developer" tab, follow this guide. The following window will then open.
  2. To write our first macro, choose "Insert" -> "Module".
  3. First, we will make a Sub procedure. All Sub procedures have to begin with Sub and end with End Sub. A Sub can not return a value, and may be compared with a program in other programming languages, where as a function is an alternative. We then call the MsgBox function to create a new window displaying our message.


  4. Let's now try to run our macro. One way to do this is by clicking the play button.

  5. Another way to run our macro is by inserting a field into our document. If you are unfamiliar to fields in Word, take a minute to read more about them at Tutorials on Word before continuing. Go to the Insert tab, and insert a field as shown below.


  6. Choose the field MacroButton and the macro you just made, in this case HelloWorld. Remember to enter a field name before clicking OK.
  7. To test our macro, doubleclick on the field created.
  8. Congratulations, you have just made your first macro in Word!



  • No labels