Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 How vb.net open word(microsoft word) to textbox?

views
     
TSbradley83
post Mar 2 2006, 10:04 PM, updated 20y ago

Getting Started
**
Junior Member
66 posts

Joined: Feb 2005


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
TSbradley83
post Mar 4 2006, 01:10 AM

Getting Started
**
Junior Member
66 posts

Joined: Feb 2005


what mean VBA stand for?
TSbradley83
post Mar 4 2006, 06:18 PM

Getting Started
**
Junior Member
66 posts

Joined: Feb 2005


my CD dont have..

 

Change to:
| Lo-Fi Version
0.0159sec    0.21    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 04:08 AM