Solved

Opening ms. word files

Posted on 2000-05-06
5
145 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

912 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

20 Experts available now in Live!

Get 1:1 Help Now