Solved

Opening ms. word files

Posted on 2000-05-06
5
144 Views
Last Modified: 2010-04-30
Who can explain me how to open a msword file in my programm, that includes also the text in its word form.



please give me some code.



i have a text field : text1
0
Comment
Question by:markyvt
  • 2
  • 2
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 2785354
I know of 2 things, but you won't be able to display the formatted text in your text box, you would need richtextbox...

1=Office Automation
 Check Microsoft Word in Project References
 Sub GetWordData
   DIM appWord as Word.Application
   DIM objDocument as Word.Document

   SET appWord = NEW Word.Application
   SET objDocument = appWord.Documents.Open ("C:\Mydoc.Doc")

   text1.Text = objDocument.Range.Text
   objDocument.Close
   SET objDocument = NOTHING
   appWord.Quit
   SET appWord = NOTHING
 End Sub


2=Webbrowser Control (to display Word Document inside of your application)
 Check Microsoft Internet Controls in Project Components
 Add Webbrowser Control to your form (with name "webBrowser")
 Sub OpenDoc(Path as string)
   webBrowser.NavigateTo Path
 End Sub

Hope this helps


0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2785393
even a richtextbox doesnt potentially handle all the formatting of a ms word document.  for this you should save the word file as a temporary text file, and then read that text file into your textbox.

How to translate a word doc to txt file:
http://www.vb-helper.com/Howto/word2txt.zip
0
 
LVL 2

Author Comment

by:markyvt
ID: 2794084
From: AzraSound
 Date: Sunday, May 07 2000 - 10:56AM CEST  
even a richtextbox doesnt potentially handle all the formatting of a ms word document.  for this you should save the word file as a temporary text file, and then read that text file into your textbox.

How to translate a word doc to txt file:
http://www.vb-helper.com/Howto/word2txt.zip

 

Thanks Azrasound but the webbrowser component does enough for me, to bad i could'nt give you also some points.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2794102
sorry i thought you were trying to read the document's text into a textbox
0
 
LVL 2

Author Comment

by:markyvt
ID: 2794246
I was but the other thing worked out better,

sorry,.

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now