?
Solved

How can I edit a Word document without using Word automation in VB6?

Posted on 2010-01-12
5
Medium Priority
?
324 Views
Last Modified: 2012-05-08
Hi guys.

I need to write some code that edits a Word document. However, I don't want to use the Word automation system in VB as that involves running Word in the background. It's a system I've used for a while and have found it to work most of the time, but it has its quirks.

Anyway. I was wondering if anybody knew of a way to edit a Word document easily but without using automation? Are there any resources that you know of that allow easy direct editing of the file itself?

cheers

Bob
0
Comment
Question by:Bobeo
5 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 26291359
I guess this is a very dificult problem, because Word object model is very extensive & complicated, so I think that probably it cannot be managed without it's native application (Microsoft Word, in this case).
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 26291495
Apart from the complexity, the .doc format is propriety, and hence unpublished.

It would involve a very steep leaning curve, but you could save the documents in RTF format, or, from 2007, as XML and edit that.

Perhaps we could address the 'quirks'.
0
 
LVL 3

Author Comment

by:Bobeo
ID: 26291763
Hi both.

Cheers for your responses. I'm going to keep the question open to further responses for a while, as I'd really like to see if anybody has a method for it. I know it's a big ask, but you never know.

Regarding the quirks, there's no particular problem. I think my main issue is how intensive the automation system is, and how long it can take to do simple tasks on some slower PCs. In avoiding Word altogether I hope mainly just to speed it up.

Thanks again.

Bob
0
 
LVL 77

Expert Comment

by:GrahamSkan
ID: 26292254
It's an even bigger ask to expect to do things faster.

There may be ways of writing the code to be a bit more efficient.

E.g.

Use range objects instead of the selection object.

and

Use For Each MyObject in MyObjects
in favour of
For i = 1 to MyObjects.Count
 
0
 
LVL 3

Accepted Solution

by:
mkrohn earned 2000 total points
ID: 26299392
I would open a txt file with DOC extension, and then write html code on it.
Word application recognizes html code.
Then you can open the document using the following method, see link:
http://support.microsoft.com/kb/170918
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

609 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