Solved

open word 2000 file and write in it.

Posted on 2002-05-30
7
223 Views
Last Modified: 2013-11-20
can anyone tell me the procedure to opening a new word 2000 file and write in it programatically.
i am using VC++ to do so.

ult
0
Comment
Question by:Ultpak
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7044228
Please search in MSDN with "HOWTO: Use Automation to Run a Word Macro with Arguments"

(Don't forget to put quotes both sides)

You will get similar operations using word from that article


GOOD LUCK
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7044230
Another Title is

"Automating Microsoft Office 97 and Microsoft Office 2000"

GOOD LUCK
0
 
LVL 3

Expert Comment

by:Crius
ID: 7045142
I don't believe he is wanting to automate word 2000, I think he wants to just read/write to a Word 2000 file.

Is this a question regarding the format of a Word 2000 file?
0
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!

 
LVL 22

Accepted Solution

by:
ambience earned 200 total points
ID: 7046232
Undertanding word file format is really an overkill when you can use Word to do the work for you, why is there automation afterall.

Here is a simple way to use Word
Import word type library, and add atleast the classes used in following code, _Application, Documents, _Document, Range etc.

COleVariant var;
_Application application;

var.vt = VT_ERROR;
var.scode = DISP_E_PARAMNOTFOUND;

application.CreateDispatch(_T("word.application"));
application.SetVisible(Visible);

Documents documents = application.GetDocuments();
_Document document = documents.Add(var,var);

Range range = document.Range(var,var);
range.InsertAfter(_T("hello"));void CMyReport::Close()

COleVariant savechanges = 1L;
application.Quit(savechanges,var,var);



0
 
LVL 3

Expert Comment

by:Crius
ID: 7047100
True enough, automating Word is one of the easiest ways to read/write a Word file, but he didn't say he has Word 2000 anywhere. He may not have Word 2000. Since he is writing a program, he may distribute the program to people who do not have Word 2000.

That is my concern..

So, if you/your userbase have Word 2000, the best way to go is written above by others. If you do not, it will get more complex. Very complex in fact.

Here is an explanation of the Word 97 file format:
http://www.redbrick.dcu.ie/~bob/Tech/wword8.html

It that link doesn't scare you, and you really want to pursue opening and reading/writing Word files with your own program, this link:
http://www.wvware.com/wvInfo.html
contains much information on the Microsoft Office formats, including Word 2000, as well as freeware libraries/products to aid in your task.
0
 

Author Comment

by:Ultpak
ID: 7048387
hi ambience

thanx it worked.
now i can write in word file.\
can u plese tell me, if i want to write at a specific position , i mean at the line 20 etc
what to do to do this.
thankx again.
ult
0
 

Author Comment

by:Ultpak
ID: 7050840
thankx for helping me
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

Suggested Solutions

Title # Comments Views Activity
java ^ examples 8 70
child constructor and parent constructor, overriding and overloading 6 93
sumHeights  challenge 17 79
Thin secure Windows 10 5 107
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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