Chapter 6 Programming with Office 97

Slides:



Advertisements
Similar presentations
Using VB with MS Applications R. Juhl, Delta College.
Advertisements

1 Linking & Consolidating Worksheets Applications of Spreadsheets.
Excel Tutorial 6 Managing Multiple Worksheets and Workbooks
Tutorial 12: Enhancing Excel with Visual Basic for Applications
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
1 Computing for Todays Lecture 11(1) Yumei Huo Fall 2006.
PowerPoint 2002 Linking Video in Presentation and Delivering Presentation on the Road.
1 Computing for Todays Lecture 22 Yumei Huo Fall 2006.
FIRST COURSE Creating Web Pages with Microsoft Office 2007.
Chapter 8 Relational Databases ActiveX Database Controls 8 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 1 1 Integrating Microsoft Office XP Tutorial 1 – Integrating Word and Excel.
Microsoft Excel 2000 Adding Visual Elements and Managing Files.
PowerPoint Lesson 9 Importing and Exporting Information Microsoft Office 2010 Advanced Cable / Morrison 1.
Chapter 11: Introduction to the Visual Basic Environment Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
Appendices A - F A-F Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Excel Integration Feature Object Linking and Embedding (OLE) and Web Discussions.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
AUTO-BUSINESS HOW DO WE USE HYPERLINKS?. Edit an image that represents a hyperlink If a picture, AutoShape, or other graphic is used to represent a hyperlink,
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
History of Windows Data Sharing Carlotta Eaton Exploring Microsoft Visual Basic 5.0 To insert your company logo on this slide From the Insert Menu Select.
LINKS TO OBJECTIVES Multiple Worksheets Multiple Worksheets Move, Copy and Paste Cells Move, Copy and Paste Cells Split into Windows Freeze Panes Range.
The Advantage Series © 2004 The McGraw-Hill Companies, Inc. All rights reserved CHAPTER 1 Integrating Office Word and Office Excel.
FIRST COURSE Integration Tutorial 1 Integrating Word and Excel.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 1 1 Integrating Microsoft Office XP Tutorial 1 – Integrating Word and Excel.
Intro to Excel - Session 6.11 Tutorial 6 - Session 6.1 Integrating Excel with Other Windows Programs and the World Wide Web.
Microsoft Office XP Illustrated Introductory, Enhanced Word, Excel, Access, and PowerPoint Integrating.
Objectives Learn about object linking and embedding (OLE) Embed an Excel chart in a Word document Edit an embedded Excel chart in Word Link an Excel worksheet.
® Microsoft Office 2010 Integrating Word, Excel, Access, and PowerPoint.
XP New Perspectives on Microsoft Office 2003 Tutorial 1 1 Integrating Microsoft Office 2003 Tutorial 1 – Integrating Word and Excel.
1 ADVANCED MICROSOFT POWERPOINT Lesson 9 – Importing and Exporting Information Microsoft Office 2003: Advanced.
PowerPoint Notes1 Microsoft PowerPoint Notes Part 1 Introduction to PowerPoint: Presentations Made Easy.
® Microsoft Office 2010 Integrating Word, Excel, Access, and PowerPoint.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Microsoft Excel 2003 Illustrated Complete Data with Other Programs Exchanging.
© 2010 Pearson Education, Inc. | Publishing as Prentice Hall1 Computer Literacy for IC 3 Unit 2: Using Productivity Software Chapter 1: Starting with Microsoft.
Excel Macros 1 Macros or, How to Automate Part of Your Spreadsheet or Worksheet.
XP Tutorial 8 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Object Linking and Embedding Tutorial 8.
FIRST COURSE PowerPoint Tutorial 4 Integrating PowerPoint with Other Programs and Collaborating with Workgroups.
How OLE Works Carlotta Eaton Exploring Microsoft Visual Basic 5.0 To insert your company logo on this slide From the Insert Menu Select “Picture” Locate.
Microsoft PowerPoint Prepared by the Academic Faculty Members of IT.
Data-information stored in files on the disks and CDs in your computer system Why should we save a file when we create it on the computer?
Chapter 28. Copyright 2003, Paradigm Publishing Inc. CHAPTER 28 BACKNEXTEND 28-2 LINKS TO OBJECTIVES Table Calculations Table Properties Fields in a Table.
Computers Are Your Future Tenth Edition Spotlight 5: Microsoft Office Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall1.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office 2010 Fundamentals by Robert Grauer, Lynn Hogan, and Mary.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 8 BACKNEXTEND 8-1 LINKS TO OBJECTIVES Import data from Access, a Web site, or a CSV text file.
XP Creating Web Pages with Microsoft Office
Microsoft FrontPage 2003 Illustrated Complete Creating a Web Site.
9.1 The Need for Integrating Data among Different Types of Software Tasks of composing a project.
Enhancing a Presentation
Getting Started with Application Software
Visual Basic Code & No.: CS 218
Introduction to Visual Basic 2008 Programming
Microsoft Office Illustrated
Microsoft FrontPage 2003 Illustrated Complete
Exploring Microsoft Office 2013 PowerPoint Comprehensive
Exchanging Data with Other Programs
ITEC 1001 Test 3 Review 11/8/2018.
Introducing Microsoft Office 2010
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Computers Are Your Future
Microsoft Excel 2007 – Level 2
Microsoft PowerPoint 2007 – Unit 2
Microsoft Office Illustrated Fundamentals
Microsoft Office Illustrated Fundamentals
Chapter 4 Enhancing the Graphical User Interface
Chapter 4 Enhancing the Graphical User Interface
Visual Basic for Applications: Introduction
Chapter 7 Database Basics
Presentation transcript:

Chapter 6 Programming with Office 97 Exploring Microsoft Visual Basic 6.0 6 Chapter 6 Programming with Office 97 The OLE Container Control and Automation By Carlotta Eaton Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Objectives... 1. Explain Windows data sharing technologies such as clipboard, DDE, OLE and ActiveX. 2. Explain OLE; differentiate between an embedded object and a linked one. 3. Understand old and new terms for data-sharing technologies. Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Chapter 6 - Programming with Office 97 Exploring Microsoft Visual Basic 6.0 Objectives 4. Use the OLE container control to embed or link an object. 5. Explain and use automation to create an application with components and functions available in Office 97 applications. Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. Copyright 1999 Prentice-Hall, Inc.

Sharing Data between Applications Clipboard Dynamic Data Exchange (DDE) Object Linking and Embedding (OLE) ActiveX Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Clipboard First sharing method available with Windows Holding area where information can be copies and transferred Limited to a single object No way to automatically update data placed on clipboard Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Dynamic Data Exchange (DDE) Introduced in later Windows versions Applications can exchange data and commands while running A connection is made between the two applications Data can be automatically updated and transferred Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Object Linking and Embedding Introduced with Windows 3.1 More sophisticated technique than DDE to achieve same results Not limited to data and commands Method of combining data created by different applications Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. How OLE Works Embedding Linking Server Application Server Application Object copied Object linked Container Application Container Application Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. How OLE Works Embedding Linking If you modify the source object Server Application Server Application Link updates and retrieves current source object Embedded (copied) object does not change Destination Application Destination Application Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. OLE Terminology Compound document - document containing elements from multiple applications Embedded object - original object is copied and stored in the compound document Linked object - original object remains stored in original file and is linked to container document Container document - the compound document that contains elements from multiple applications Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

New and Old OLE Terminology Container application previously called client or destination application that receives the object OLE Container control previously called OLE client control permits an OLE object to be added to a form Server application previously called source application that creates the object Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. ActiveX Technology ActiveX servers or ActiveX components previously called OLE servers or OLE automation servers originally ActiveX referred to software components that were created for the Web using OLE technology ActiveX now refers to a wide range of communication techniques where applications make their capabilities available to other applications Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The OLE Container Control Permits an OLE object to be added to a form Insert an OLE Object at design time Place an OLE container control on a form The Insert Object dialog box displays (see next slide) Insert an OLE Object at run time Click the Cancel command button on the Insert Object dialog box, and add code to insert the object later In-place activation Allows direct editing of the OLE object placed in the OLE container control Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

OLE Container Control Insert Object dialog box Create a new object Insert an object at runtime Create a object from an existing file Display only an Icon Link an existing object Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

OLE Container Demonstration Hands-On Exercise 1 Open and save the OLE Starter project Add the OLE Container control to the Embed form, Paste form, Link, and Icon forms Modify the source worksheet Test the embedded objects Test the linked objects Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Automation Visual Basic technology that allows us to use code and objects from other Windows applications in our applications Previously called OLE Automation Referenced application (such as Word or Excel) must be available on the end user’s computer Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Available References References dialog box First, determine which automation objects are available using the References dialog box Word 97 Object Library Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Object Browser Next, find the function or method to use for spell check capability Check Spelling available here Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Viewing Object Hierarchies Use help to display all the available Microsoft Word objects Spelling Suggestions available here Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Declaring an Automation Object First, declare the object Late Binding when the object is generically declared the slowest form of binding Early Binding when the object is specifically declared such as Word, Excel, worksheet etc. usually run fastest Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The CreateObject Function Next, create a new automation object Set objectname = CreateObject(Application.Object) Where Set is the required command objectname is the name of the automation object CreateObject is the required function Application is the class name of the application Object is the type of object Examples: Set xlsSheet = CreateObject(“Excel.Sheet”) Set wdDoc = CreateObject(“Word.Document”) Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The GetObject Function To create a new automation object from an existing file Set objectname = GetObject(filename) Where Set is the required command objectname is the name of the automation object GetObject is the required function filename is the location of the existing file Examples: Set xlsSheet = GetObject(“c:\data\finance.xls”) Set wdDoc = GetObject(“c:\docs\letter.doc”) Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The App.Path Global Variable To get a file from the current folder where your Visual Basic application is running, use the App.Path global variable Examples: Set xlsSheet = GetObject(App.Path & _ “finance.xls”) Set wdDoc = GetObject(App.Path & _ “letter.doc”) Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Release an Automation Object Remove the object from memory when we are finished with an object with the Set statement and Nothing keyword Set objectname = Nothing Where Set is the required command objectname is the name of the automation object Nothing is the required keyword Examples: Set xlsSheet = Nothing Set wdDoc = Nothing Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The Spell Pad Project using Automation Hands-On Exercise 2 Create the Spell Pad form Add menus and set the form properties Add code to display the form Test the form code Add the Word Library reference Add code and test spell check Add code and test grammar check Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Saving OLE Object Save changes to an OLE object using the SaveToFile method of the OLE container control Objectname.SaveToFile filenumber Where objectname is the name of the automation object SaveToFile is the required method filenumber is the number of the file and must correspond to an open binary file Examples: NextFile = FreeFile oleObject.SaveToFile NextFile Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The Mortgage Minder Project Mortgage Minder Excel Workbook Setup worksheet contains setup values and assumptions Term Option worksheet calculates payments for several term options Loan Comparisons worksheet calculates loans with varying interest rates Schedule worksheet calculates amortization schedule for loan Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The Mortgage Minder Project Mortgage Minder Forms Splash form Main form More Info form Comparisons form Term Options form Schedule form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Splash form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Main form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The More Info form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Term Options form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Comparisons form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. The Schedule form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

The Mortgage Minder Project Hands-On Exercise 3 Open and save the project, module and form files Test the existing forms Modify and test the Options form Modify and test the Comparisons form Modify and test the Schedule form Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Summary ... Utilize code contained in other applications All Office 97 applications are ActiveX servers Clipboard, DDE, OLE, and ActiveX progression of data sharing technologies Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Summary Introduction to OLE (Object Linking and Embedding) Automation is a powerful tool that allows us to work with programmable data objects Created Spell Pad and Mortgage Minder applications Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Practice with Visual Basic 1. Using the OLE Container Control 2. In the Kitchen with Automation 3. Sample Word Automation 4. OLE Container Sample Application 5. More Spell Check 6. OLE and PowerPoint Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.

Copyright 1999 Prentice-Hall, Inc. Case Studies Programming with PowerPoint Careers in Visual Basic Programming a Handheld PC Programming with Excel Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc.