Solved

Opening ms. word files

Posted on 2000-05-06
5
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month5 days, 8 hours left to enroll

627 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