Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword or section
Like this
0 of .
Results for:
No results containing your search query
P. 1




|Views: 4,648|Likes:
Published by SubashVenkataram

More info:

Published by: SubashVenkataram on Feb 06, 2008
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





OFFICE AUTOMATION with VBA (Office 97/2000)
Section Topic Page
1 Introduction
31.1 Macro Basics 5
2 Office Objects
3 Visual Basic for Applications
153.1 Control Structures 18
4 Excel Objects and Collections
5 Code Optimisation
6 ActiveX Controls and Dialog Boxes
316.1 Using ActiveX Controls 34
7 Working With Events
377.1 Worksheet Events 417.2 Chart Events 427.3 Workbook Events 437.4 Application Events 44
8 Using Custom Dialog Boxes
9 Menus and Toolbars
559.1 Menus 579.2 Toolbars 60
10 Word Objects
11 Interacting with Other Applications
12 Using DLLs and the Windows API
Jeff Waldock , SHU Science & Maths. July 2000
This document is intended as an introductory guide to the development of customisedapplications using Microsoft Office 97 or Office 2000. We concentrate on using theExcel application, although the general skills gained are equally applicable to the otherOffice applications. It is not an exhaustive review of all of the features of these twopackages - there are too many! I hope, however, to be able to describe the essentialfeatures of programming in Visual Basic for Applications (VBA) and to illustrate someof its capabilities by means of a range of illustrative examples.The 'macro' language VBA is a variant of the popular Visual Basic programminglanguage. It offers the programmer the facility to automate and enhance the Officeapplication and to develop a customised application for an end user who may not havethe interest or desire to do so for themselves. These techniques can also be used todevelop applications which streamline the use of the Office applications for a moreexpert user - they may be able to apply some level of customisation themselves.In Office95 the macro language for Word was WordBasic, but this has now beenreplaced by VBA. VBA can also be used to control Access, Powerpoint and Outlook, aswell as an increasing range of third-party applications (i.e. not made by Microsoft),and therefore offers a unified, consistent programming interface.One of the first questions to ask is - why do you need to program MS Office? Why doyou need to do more than use the built-in functions? These are some of the answers:
Provision of a customised interface - toolbars/menus/controls/dialog sheets
Provision of specialised functions
The execution of complex sequences of commands and actions
Complex data handling procedures
Interaction with and use of other applicationsIf all this needs to be added on to Excel and Word to make them useful, why not useVisual Basic itself? Clearly there are pros and cons to using VBA as a developmentplatform, and it is important to be informed of these:Pros:
Through VBA, Excel and Word provide a wide range of in-built functions
It provides a convenient data display tool - the Excel worksheet
It has powerful in-built charting facility.
It provides simple access to the other built-in features, e.g. spell-checking
Distribution is easier - so long as the target user has a copy of OfficeCons:
There are a more limited set of graphical controls available than in VB
In many cases data have to be written to cells (in Excel) before they can be used incharts and some functions.
There is a certain overhead in running Office apps - these are not lightweight apps!This material will provide you with the information necessary to develop customisedapplications that can carry out complex tasks with a high degree of automation. Thismight be as simple as an added worksheet function that Excel does not provide, or itmight involve developing dialog boxes, coding and interacting with other applications
and Windows itself. It will be assumed that you are familiar with the BASICprogramming language, although if you are rusty you’ll soon pick it up again!To make best use of this documentation you should use it in conjunction with thesample programs provided via the unit's web pages. You can access these either byfollowing the links from the Maths main page:

Activity (156)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
mihai37 liked this
rselvaraj65 liked this
jarmgl2010 liked this
srinivas3us liked this
Dan liked this
JTEB liked this
JTEB liked this
Jack_Durion liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->