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
Solved

open word 2000 file and write in it.

Posted on 2002-05-30
7
216 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.

809 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