What is OLE and DDE? Explain?
Answer / nipesh
hi...guys..
===============================================================
Skip, You are actually using AUTOMATION here. Something
that MSFT supports, but not strictly OLE. OLE is a much
lower level concept - a part of which allows a programmer
to access the underlying structured storage of a MicroSoft
file. Dealing w the low level OLE interfaces would allow
one to access and edit a MSFT Office file without actually
having MSFT office installed on the machine at all. A
useful application of this means of file access would be
for code running on a server (that does not have MSFT
office installed), where an office file must be
accessed/modified w/o using the heavy and inefficient
AUTOMATION strategy that you have posted here. The code
that you have posted here is useful for client side
applications where AUTOMATION does not pose such a
scalability risk. Hope this helps clarify things. M
OLE Code examples:
'Excel example
Private Sub cmdExcel_Click()
Dim intCol As Integer
Dim intRow As Integer
Dim oXL As Object
Dim oBook As Object
Dim oSheet As Object
Dim oRange As Object
intCol = 3
intRow = 1
'Load Excel and create the object
Set oXL = CreateObject("Excel.Application")
'Turn off alert messages.
oXL.DisplayAlerts = False
'Load a new workbook and create the workbook object.
Set oBook = oXL.workbooks.Add
'Create the worksheet object.
Set oSheet = oBook.Sheets(1)
'Enter a value in a cell.
oSheet.cells(intRow, intCol).Value = "Test"
'Display the Excel session.
oXL.Visible = True
End Sub
'Internet Explorer example
Private Sub cmdIE_Click()
Dim oIE As Object
Dim oDoc As Object
Dim oBody As Object
'Create the IE application object.
Set oIE = CreateObject("internetexplorer.application")
'Load the URL.
oIE.Navigate ("msdn.microsoft.com")
'Wait for the web page to load completely.
Do While (oIE.ReadyState <> 4)
Loop
'Create the document object.
Set oDoc = oIE.Document
'Create the document body object.
Set oBody = oDoc.Body
'Display the website title.
MsgBox oDoc.Title
'Show a portion of the web page text.
MsgBox Mid$(oBody.innerText, 1, 255)
'Show a portion of the web page HTML.
MsgBox Mid$(oBody.innerHTML, 1, 255)
'Would the user like to see the original document?
If (MsgBox("Would you like to see the web site?", _
vbQuestion + vbYesNo, "Show IE?") = vbYes) Then
'Display IE.
oIE.TheaterMode = True
oIE.TheaterMode = False
Else
'Close IE.
oIE.quit
End If
End Sub
'Word example
Private Sub cmdWord_Click()
Dim oWord As Object
Dim oDoc As Object
Dim oSentence As Object
'Create the Word application object.
Set oWord = CreateObject("word.application")
'Open the sample document.
Set oDoc = oWord.Documents.Add(App.Path & "\WordSample.doc")
'Ask the user if they would like to parse the document.
If (MsgBox("Would you like to view" & vbCrLf & _
"the document contents" & vbCrLf & _
"one sentence at a time?", _
vbQuestion + vbYesNo, "Parse Word Doc?") = vbYes) Then
'Parse through the document one sentence at a time.
For Each oSentence In oDoc.Sentences
'Display the sentence.
MsgBox oSentence.Text
Next
End If
'Ask the user if they would like to see the document text.
If (MsgBox("Would you like to view" & vbCrLf & _
"the entire document text?", _
vbQuestion + vbYesNo, "View Contents?") = vbYes) Then
'Display document text.
MsgBox oDoc.Content.Text
End If
'Would the user like to see the original document?
If (MsgBox("Would you like to see the original document?", _
vbQuestion + vbYesNo, "Show Word Doc?") = vbYes) Then
'Display the MS-Word session.
oWord.Visible = True
oDoc.Activate
Else
'Terminate MS-Word.
oWord.quit
End If
End Sub
| Is This Answer Correct ? | 2 Yes | 0 No |
How can you filter out specific type of file using file system controls?
what are the Types of LockEdits in RDO?
What is recordset in visual basic?
___,_____ and ____ container objects. ___ Property is to compress a image in image control. ___,___ and __ are difference between image and picture controls. To set the command button for ESC ___ Property has to be changed. ___,__,___ are the type of combo box? __ no of controls in form. OLE is used for _______ ___ is the control used to call a windows application. Clear property is available in ____,___ control. ___ Property is used to count no. of items in a combobox. ___ is a property to resize a label control according to your caption. ___ property is used to change to ___ value to access a identity column'in datacontrols. _____ is the property to ___,____,____ are valid for recordsource property of dat control. Timer control contains ________ no. of events. ____ property is used to lock a textbox to enter a datas. ____ is the difference between Listindex and Tab index. ____ property of menu cannot be set at run time. _____ collection in recordset used to assign a value from textbox to table columns without making abinding in datacontrol. ___ argument can be used to make a menuitem into bold. ___,___ arguments will be used to run a executable program in shell function ___ property used to add a menus at runtime. ___ VB constant make the menu item in centre. ___ method used to move a recordset pointer in nth position in DAG.
What is a Component?
What is ODBC?
What is connection object in vb net?
What is the differece between the (name) and caption properties of a control?
How would you run your ActiveX Document Dll?
What is the use of Scalewidth and ScaleHeight Proeperty?
How many nuber of controls are there in form?
To validate a range of values for a property whenever the property values changes,which type of property procedure you use?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)