if the office application you are automating continues to reside in memory after your visual c++ program finishes executing, the most likely cause is that you have not released an acquired interface. for more information, see prb: office application remains in memory after program finishes (q238987)
how do i access my document properties in an office document?
you can automate microsoft word, excel or powerpoint with visual c++ to retrieve and manipulate both built-in and custom document properties. for more information and an example, see howto: use visual c++ to access documentproperties with automation (q238393).
you can also retrieve document property information without automation and even without the need for the office application that created the file. office documents are ole compound documents that store document properties in persistent property sets. these property sets are managed by com/ole and can be retrieved using the ipropertysetstorage and ipropertystorage interfaces. for details, see howto: read compound document properties directly with vc++ (q186898) and dsofile.exe lets you edit office document properties from visual basic and active server pages (q224351).
how can i automate an embedded microsoft office document?
to automate an embedded office document, you must first obtain the idispatch pointer for the document object. once you've obtained the idispatch pointer to the document object, you can automate the server by calling the appropriate methods and properties for that server. for some examples, see howto: embed and automate a microsoft excel worksheet with mfc (q184663) and howto: embed and automate a word document with mfc (q238611).
my automation client for an office application runs without error except when i run my client from an nt service.
microsoft office is designed for use on client systems as end-user products and has not been optimized to run from windows nt services. automating an office application from a service is not recommended or supported. for details on problems that you might encounter automating an office application from a service and common causes of those problems, please see info: considerations for server-side automation of office (q257757).
visual c++/mfc—information and sample code
this section contains information and links to code samples for office automation using visual c++ and mfc. any one of the articles listed below may illustrate automation with a specific version of microsoft office. in most cases, you can follow the step-by-step instructions in the article and run the sample without needing to modify the code. however, if you are using one of the code samples created with a version of office earlier than the one you are automating, you may need to modify the code to account for new arguments of updated methods. for more information, see the knowledge base article type libraries for office may change with new release (q224925).
general concepts
create automation project using mfc and a type library (q178749)
locating resources to study automation (q152023)
find the path and version of an office application from visual c++ (q247985)
use ole automation from a c application rather than c++ (q181473)
create an automation client project using atl (q196135)
do 16-bit automation in c++ using vc 1.52 (q194656)
ole/com concepts