C++ COM add-in - find if MS Word, PPT, Excel has unsaved changes

Shabari Pragash 126 Reputation points

I have created a basic COM add-in for MS office apps like Word, PPT, Excel in Visual C++ using _IDTExtensibility2 interface.

Now i want my add-in to find if Word, PPT, Excel has any unsaved changes.

FYI: I have not chosen VSTO or Office JS add-in due to dependency/deployment reasons.

Kindly provide solution in C++.

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,603 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,659 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
904 questions
PowerPoint Management
PowerPoint Management
PowerPoint: A family of Microsoft presentation graphics products that offer tools for creating presentations and adding graphic effects like multimedia objects and special effects with text.Management: The act or process of organizing, handling, directing or controlling something.
223 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,672 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 42,161 Reputation points

    You should review the object models for each of Excel, Word and PowerPoint. If you look carefully you will see that the Excel workbook object, the Word document object and the PowerPoint presentation object each have a Saved property which will give you the information you want.

  2. RLWA32 42,161 Reputation points

    Maybe it is too early to call get_activedocument() method as during onConnection the document is yet to be created. But i don't know how/where to call get_activedocument() method once document is created.

    Yes, that's a problem. Since I previously provided you a sample Add-in for a TaskPane I updated the sample to provide some minimal functionality. All the previous comments about how it was created are still in effect. The updated sample can create a TaskPane in Excel and Word. The ActiveX control hosted by the TaskPane now includes two items - an edit control that identifies which Office application it is loaded into and a button that checks the Saved property.

    For Excel -




    For Word -




    The updated Add-In can be obtained at s!AmnqrCFBv4nDgiLKcnfX4cf0S2a0