OLE control in Visual Basic 6.0


Insertable Objects (like the Excel Worksheet object; with a list of the employees, or a Project Calendar object having the scheduling information for a project.) These can be added to the toolbox, so they can be considered controls.

OLE (Object Linking and Embedding) is a means to interchange data between applications. One of the primary uses of the OLE Container control was to embed Word documents or Excel spreadsheets in a form. This is the control to use when you want to link or embed an object into your Visual Basic application.

1. From the Windows Start menu, choose Programs, Microsoft Visual Studio 6.0, and then Microsoft Visual Basic 6.0.

2.Click the OLE tool form toolbox.

 

 

 

3. Double clicking the OLE control on your form will activate the object’s application. Visual Basic also allows you to activate the object from your code.A Insert dialogbox is open.There are two option create new or create from file.you select it as you want .

4. First we create new Object .

5. Select Create New and Microsoft office Excel Chart from the Object Type list.

 

 

 

 

 

 

 

 

6. Creating a Excel chart will allow you to access the Excel application to define the chart.

7. Select the Excel chart.

8.Run your application. Double click on the OLE control  and use it  in your project as you want.

Second is Linking to an existing object for this:

1. Add a  OLE to the form.

2. Select Create from File and use the Browse button to find the Word document .

3. Select Link and click on OK.

 

 

 

 

 

 

 

 

4. This Word document page has been sized so that it will fit onto a form. Change the SizeMode property of the OLE control to Stretch.

5. Run your application. Double click the OLE control to see that Word is activated with the selected document opened.

6. Close Word and stop your application.

 

Comments are closed.