Solved

accessing word

Posted on 2000-05-02
6
181 Views
Last Modified: 2013-11-20
Hello i want access MS-Word from VC++.
How Can i do it? please explain detaily

Thanks
0
Comment
Question by:yesnathan
6 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2769584
Hi,

To access word u can use either CreateProcess(..)

CreateProcess(
         NULL,
         "C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE",
         (LPSECURITY_ATTRIBUTES) NULL,
         (LPSECURITY_ATTRIBUTES) NULL,
         TRUE,
         CREATE_NEW_CONSOLE,
         (LPVOID) NULL,
         (LPTSTR) NULL,
         lpStartupInfo, lpProcessInfo ) ;

Please go through the help for each parameter


OR

WinExec(..) this takes the exe name combined with the file name to be opened initially(if needed) and the style. here is the sample code.

WinExec("C:\\Program Files\\Microsoft Office\\Office\\WINWORD.EXE",SW_MAXIMIZE);

Here i am just opening the word if u want u just put this is a CString and add it up with the file name u want to open initialy.

Hope this helps u out
0
 

Author Comment

by:yesnathan
ID: 2769677
hello inpras

        I want to access the word, i.e)drawing lines,printing information and so on... Do you have any side address???????? or anyother information???
               
0
 

Author Comment

by:yesnathan
ID: 2769687
Edited text of question.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 3

Accepted Solution

by:
_mb_ earned 50 total points
ID: 2769955
Use OLE-Automation to get access to Word. Open the class wizard and create IDispatch classes from the type libraray
'msword8.olb'. You find it on your computer. Then you can start and handle word as you want.
Here is an example, that starts word:

_Application objWordApp;
objWordApp.CreateDispatch("Word.Application");
objWordApp.SetVisible(TRUE);
0
 

Expert Comment

by:raschalk
ID: 2770767
Hi,

Here is an easy solution, which not only starts Word, but also opens the document you want it to:


ShellExecute(0, 0, "word.exe", "document.doc", 0, SW_NORMAL);




--Regards,  Rudy
0
 
LVL 1

Expert Comment

by:majorjohn
ID: 2776229
mb's comment is most authentic. Because there u have complete control of Word from ur VC++ program.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 60
Add content to output file 4 63
Line meaning 9 86
Making an alias 7 95
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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