Library tutorials & articles
Using OLE Automation in VB
By S.S. Ahmed, published on 24 Feb 2002
Page 1 of 3
- Introduction
- Creating the Application
- The rest of the code
Introduction
Many beginners start developing programs in VB. They hear about OLE, Automation, ActiveX, COM, etc. but they are not aware of all these technologies. If you are a beginner and you want to know more about OLE, then you should read this article. It will help you get started writing code using OLE automation capabilities.
In this program, we'll use Word object. We'll use two objects, one of the Word Application class and one of the Word Document class. We'll open the Word Application and a document, and then we'll let the user save the document via our application.
Related articles
Related discussion
-
Run-time error '91'
by crazyidane (0 replies)
-
Problem handling Redirects with MSXML2.XMLHTTP
by brandoncampbell (2 replies)
-
vbinputbox pauses code while it waits on response. How can I reproduce that?
by brandoncampbell (1 replies)
-
Sending SMS in VB 6
by sirobnole (6 replies)
-
Comboxbox listindex in ActiveX Control
by brandoncampbell (1 replies)
this is a great example of how to create a new document using OLE but how can I point to and open an existing document? I want to edit the text that your example had me save.
Works great! However in your close_cmd button you must comment out the objapp.quit() because vb.net claims it's ambiguous (which is why i put the me.close in there). Also, I read somewhere that we shouldn't use the unload command--I believe it was from Rollarshade, so I didn't. Now--how would I load data into the Word document using a SQL Server?
If objDoc Is Nothing Then
MsgBox("Application not running")
Else
Me.Close()
'objApp.Quit()
objDoc = Nothing
objApp = Nothing
End If
If objDoc Is Nothing Then
Me.Close()
Else
MsgBox("Please close application first")
End If
This thread is for discussions of Using OLE Automation in VB.