Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
545 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Written by Andy Brown
In this tutorial
Although this tutorial is mainly about Excel VBA, we thought we'd briefly show how events work in various other Microsoft Office applications.
Microsoft Word follows pretty much the same pattern as Microsoft Excel:
You can double-click on ThisDocument to attach code to an event for the document.
The list of events available isn't as rich as it is for Excel:
The list of events doesn't include BeforeClose, for example.
There is a way to create additional events for Word using something called an event sink, but it's scary stuff, and you'll need to understand classes to work out what's going on.
PowerPoint doesn't allow you to attach code to events easily:
There is a presentation open, but you can't see that in Project Explorer.
However, as for Word there is a way to attach code to events for a presentation by creating something called an event sink (see above).
Even if you do create a PowerPoint event sink, you still won't have truly solved the problem, as you still need something to run a macro to create the event sink in the first place!
The whole of Access form and report design is based around the concept of events:
This diagram shows the events available for a simple label control (a bit of text stuck on a form).
Whereas events in Excel, Word and PowerPoint are optional extras, you won't be able to write VBA code in Access forms or reports without using them all the time.
The events which can occur in an Outlook session are shown below:
Want to create a rule for how new mail should be treated? Don't bother with the Outlook rules - why not create your own in VBA!
Outlook macros are all held in a single file with an .OTM extension.
As the above examples show, handling events in Excel VBA is - as is so often the case - easier than doing the same thing in other MS Office applications.
You can learn more about this topic on the following Wise Owl courses:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.