Share this Page URL

Chapter 17. Using Visual Basic to Manage... > Using Visual Basic to Work with Data... - Pg. 605

Using Visual Basic to Manage Data 605 As you can see, the financial data, which has the Currency data type applied to it in Access, doesn't appear with currency formatting in PowerPoint. We added the dollar sign in the Visual Basic code. You might need to refine the layout and formatting in this presentation, but the raw data comes straight from your database. Just the Steps Write code to use Access data in another Office application 1. 2. 3. 4. 5. 6. In the Visual Basic Editor, click Tools, References. In the References dialog box, select the entry for the Office application object library you want work with, and then click OK. Start a Visual Basic procedure by declaring a variable for the Application object associated with the Office application. Declare variables for the other objects you need to work with. For example, for Excel, these objects might include a Workbook object and a Worksheet object. Use the CreateObject method to create an instance of the Office application you are working with. Set the other object references as required, and then use the properties and methods of these objects to perform the operations you want. Set the object variables to Nothing at the end of the procedure to release resources allocated to the objects. Quick Check Q. When working with the PowerPoint object model, which property do you need to set to False before applying specific formatting to the background of a slide? A. You need to set the FollowMasterBackground property to False (using the constant msoFalse ). Q. What steps do you need to follow so that Visual Basic uses early binding when running code that includes objects from another application's object model?