WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Using The Object Browser

One of the big questions newcomers to OLE often ask is "How do I find out more about the OLE objects?"

If you have Microsoft Office, depending on which version you have, most of the Office products have a Visual Basic for Applications (VBA) editor. This feature lets you write scripts to control the various office products. Automating Office products with Winbatch is remarkably similar to VBA, since you often use the same features.

Each application has an Object Model. This is basically a blueprint or roadmap that describes what can be done with a particular application and how to do it. When you think about an object model, think in terms of:

	Objects				These are entities like the application itself (Access or Excel); or a worksheet, or a table.
	Collections			These are usually arrays of objects. For instance a database contains an array of tables.
	Methods				These are the actions used to perform commands, like exporting, or opening a database.
	Properties			These are descriptions, for instance: a font has a property called .color, or a recordset has an .EOF property.
	Constants			These are values that are often given descriptive names. In Winbatch @True is equal to 1.
To get to the Object Browser, open MS Excel (or use another application if you prefer) and get to the VBA editor. You can get to the VBA editor by hitting the keystroke combination of ALT-F11. To EXIT hit ALT-Q (or use the FILE menu.)

Hit ALT-F11 again and re-open the VBA editor. Across the top you'll see the familiar MS menus. Go to the TOOLS menu and click on REFERENCES. You'll see a small dialog open with lots of checkboxes inside it. You can hilight a checkbox without checking it and get the preliminary information on what an item is for.

There might be a few items that are "pre-checked" which you can ignore. Each time you check an item, Excel adds it to its Object Browser. Each contains the blueprint or roadmap to give us the information needed for coding using OLE with the application you checked.

Depending on what your trying to automate check the following items:

	(if you're using MS Excel, the first one should already be checked.)
	
	Microsoft Excel 10.0 Object Library (if you don't have 10, then check whichever is highest for you.)
	Microsoft Access 10.0 Object Library
	Microsoft DAO 3.6 Object Library
	Microsoft HTML Object Library
	Microsoft Internet Controls (this is for MSIE)
Then hit OK. You can look at others (like MS Word, etc.) later.

Now hit F2. This opens the Object Browser. You should see a pair of dropdown boxes near the menus at the top, one of which has in it.

Click on:

	Excel to look at the MS Excel Object Model
	Access to look at the MS Access Object Model
	DAO to look at the MS DAO Object Model
	SHDocVw to look at the MSIE Object Model
	MSHTML to look at the MS HTML object Model
With the exception of the last two, each one should be separate from the others. When using MSIE via OLE, you not only control the browser, but you generally work with the HTML on the page too. DAO and Access work together too.

Now to find out about something, you can search for it. Use the dropdown box below the item you clicked on. So for instance, if you wanted to find out about recordsets in MS DAO, you would click on DAO, then in the box below enter: 'recordset'.

The search feature will go through the object model and find all the entries that deal with recordset and display them. You can sift through them and decide which ones you want. Find the CLASSES window and click on Recordset. Find the MEMBERS OF RECORDSET window and find EOF, click on it. Underneath, down near the bottom you'll see:

	Property EOF As Boolean
	    read-only
	    Member of DAO.Recordset
Which will give the details of that item. Now you know that when you're dealing with the recordset's .EOF property, it's expecting a boolean value and you can plan for it accordingly in your script. You can go through the examples provided and enter some of the methods and properties (.GetElementsByTagName, etc.) and enter them in and see what information is provided to them. If you need more information, hit the button with the golden question mark on it (or F1). If your VBA help is installed, it will open the help file and provide you with more detailed information on that item.

In some cases the Object Model may be confusing, so you may need to do some searching on the web or in books to find out how a particular object, method or collection is accessed.

By spending time with an application's object model, you can find out how it works and what options are open to you.

Good luck.


Article ID:   W16562
File Created: 2010:02:10:14:33:48
Last Updated: 2010:02:10:14:33:48