473,394 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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


Jun 5 '06 #1
1 1539
RMT

word..Visible = True

"Bob" <bd*****@sgiims.com> wrote in message
news:ed**************@TK2MSFTNGP04.phx.gbl...
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

Jun 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
11
by: Ron | last post by:
Hello, I'm having an aggravating time getting the "html" spewed by Word 2003 to display correctly in a webpage. The situation here is that the people creating the documents only know Word, and...
20
by: Stephan Golux | last post by:
It seems I have run afoul of an unfixable and acknowledged bug in my beloved access 97 which has no workaround other than to upgrade. Current supported upgrades are 2002 and 2003. 2003 appears...
10
by: Neil | last post by:
An article at http://news.com.com/2100-1012-991694.html?tag=fd_top states: "XML would allow easier interchange of data generated in Office documents with back-end systems or existing Web...
5
by: Jason James | last post by:
I all, I have a VB.Net app that words just fine when automating MS Word 2003, when Word is part of MS Office Professional edition (even with SP1 installed). However, if I install the app onto...
3
by: Chris Davoli | last post by:
I've got a requirement to build a page using MS WORD and then have the page show up on a web site. I know I can do a binary write and open up the WORD document in IE plugin. Don't really want to do...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
4
by: shelley_2000 | last post by:
What is the best approach to collect and load Employee Resume Data from External Employees who may not have Microsoft access? If is likely they will have Microsoft Word, but not Microsoft Access. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.