First, I create a new project within Visual Studio .NET and add a reference to the Microsoft Word type library. I am using Microsoft Word 2003, so the type library is Microsoft Word 11.0 Object Library. Once the reference is added, I can use the Word objects in the code.
for example
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Word
Public Class Form1 Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFileName As String
Dim word As New Microsoft.Office.Interop.Word.Application
Dim doc As Microsoft.Office.Interop.Word.Document
Try
doc = word.Documents.Open("c:\test.doc")
doc.Activate()
Catch ex As COMException
MessageBox.Show("Error accessing Word document.")
End Try
End Sub
End Class
This post has been edited by bradley83: Mar 2 2006, 10:16 PM
How vb.net open word(microsoft word) to textbox?
Mar 2 2006, 10:04 PM, updated 20y ago
Quote
0.0159sec
0.21
6 queries
GZIP Disabled