Solved

open word 2000 file and write in it.

Posted on 2002-05-30
7
229 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
[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
  • 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
Independent Software Vendors: 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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