?
Solved

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

Posted on 2010-01-12
5
Medium Priority
?
321 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
[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
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 76

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 76

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

Technology Partners: 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

764 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