Microsoft Office Tutorials and References
In Depth Information
Using VBA to Develop Utilities
Here’s an extremely simple VBA macro that toggles the page break display:
Sub TogglePageBreaks()
With ActiveSheet
.DisplayPageBreaks = Not .DisplayPageBreaks
End With
End Sub
You can store this macro in your Personal Macro Workbook so that it’s always available. Or you
may prefer to package your favorite utilities in an add-in. For quicker access, you can assign your
utility macros to a shortcut key or a right-click shortcut menu or modify your Quick Access
toolbar or the Ribbon.
As you’ll see, creating utilities for Excel is an excellent way to make a great product even better.
Using VBA to Develop Utilities
Excel 5, released in 1992, was the first version of Excel to include VBA. When I received the beta
version of Excel 5, I was very impressed by VBA’s potential. VBA was light-years ahead of Excel’s
powerful (but cryptic) XLM macro language, and I decided that I wanted to explore this new
language and see what it was capable of.
In an effort to learn VBA, I wrote a collection of Excel utilities by using only VBA. I figured that I
would learn the language more quickly if I gave myself a tangible goal. The result was a product
that I call the Power Utility Pak for Excel, which is available to you at a discounted price as a
benefit of buying this topic. (Use the coupon in the back of the topic to order your copy.)
I learned several things from my initial efforts on this project:
h VBA can be difficult to grasp at first, but it becomes much easier with practice.
h Experimentation is the key to mastering VBA. Every project that I undertake usually
involves dozens of small coding experiments that eventually lead to a finished product.
h VBA enables you to extend Excel in a way that is consistent with Excel’s look and feel,
including custom worksheet functions and dialog boxes. And, if you’re willing to step
outside of VBA, you can write XML code to customize the Ribbon automatically when your
application is opened.
h Excel can do almost anything. When you reach a dead end, chances are that another path
leads to a solution. It helps if you’re creative and know where to look for help.
Few other software packages include such an extensive set of tools that enable the end user to
extend the software.
Search JabSto ::

Custom Search