Need to start word 2003 and show existing rtf doc in VB.Net

B

Bob

I have the follwing snippet of code, lets me find a document and then open
it, but thw word application does not show up.

I had similara to this in vb6 and it worked, but I can't get it to show in
Vs2005 Vb.Net

Can anyone tell me how to show the word application from within VB.net. I
need this and I need to be able to add a new file.
I'll have two diffrent menu items. the edit existing file and the add new
word file menu.
Here's the snippet I got for the Edit existing file, It doe something but
doesn't show word on screen.

Private Sub mnuOpenAndModWord_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuOpenAndModWord.Click

Dim Wordfolder As String

Wordfolder = My.Settings.DefaultOriginalTextFilesFolders

Me.ofdWordDoc.InitialDirectory = Wordfolder

If ofdWordDoc.ShowDialog() = System.Windows.Forms.DialogResult.OK Then

Dim WordFile As String

WordFile = Me.ofdWordDoc.FileName

Me.Cursor = Cursors.WaitCursor

Dim word As New Microsoft.Office.Interop.Word.Application

Dim doc As Microsoft.Office.Interop.Word.Document

Try

doc = word.Documents.Open(WordFile)

doc.Activate()

Catch ex As COMException

MessageBox.Show("Error accessing Word document.")

End Try

Me.Cursor = Cursors.Default

Else

End If

End Sub



Any help would be appreciated,

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top