OLE Automation and VBA VB Help

Visual Basic is a highly successful object-oriented language because it manages to hide many of the details of using and manipulating objects. The elements you use to build a user interface are objects, and you manipulate them via their properties and methods. By now, you should be quite familiar with Visual Basic’s object nature.

This chapter explores two more major aspects of Visual Basic’s object nature: OLE and OLE Automation. OLE (pronounced “OH-LAY”) lets Visual Basic applications access the functionality of other applications in the Windows environment. The controls you’ve used so far are built into Visual Basic. They appear in the editor’s Toolbox
and you can place them on Forms with point-and-click operations. Some objects in the Windows environment, however, aren’t unique to Visual Basic and don’t come with the language. They are supplied by other applications, but you can use them within your own applications.

A Word document is such an object, and you can incorporate DOC files in your applications. You don’t have to know much about Word files or how documents are stored on disk to use them. After you incorporate them in your applications and the need arises to edit them, you can momentarily borrow Word’s menus and toolbars and display them in your own application. Your users can then edit the document as if they were using Word-all from within your application’s window .

In addition, you can program applications like Word by manipulating the objects . they expose through VBA (Visual Basic for Applications). VBA is an increasingly popular and significant language that allows programmers to customize popular applications (like Word and Excel) rather than develop new applications to meet the specific requirements of the workflow in small businesses and corporations. You can easily apply your VisualBasic knowledge to VBA, and you should familiarize yourself with the structure and basic principles of VBA.

In the first part of the chapter, you’ll learn how to extend Visual Basic by using OLE to incorporate objects exposed by other applications into your applications. The second half of the chapter is an introduction to VBA. It shows you how to exploit the rich features of Word, Excel, and Outlook from within you Visual Basic applications by OLE automating them with VBA.

Posted on November 5, 2015 in OLE Automation and VBA

Share the Story

Back to Top
Share This