Click here to Skip to main content
Click here to Skip to main content

How to Check Whether Word is Installed in the System or Not

, 29 Nov 2013
Rate this:
Please Sign up or sign in to vote.
After the tip on Excel, here we will explore the trick to verify whether Word is installed in the client's system or not by C#.

Introduction

After the tip on How to Check Whether Excel is Installed in the System or Not, we are going to do the same for Microsoft Word.

If you are using Microsoft.Office.Interop.Word for Word related operations in your application, then you must check if Word is installed in the client machine or not. This tip gives you that trick.

Background

This little piece of code is a result of the research after the comment by Marco Bertschi on my previous tip (How to Check Whether Excel is Installed in the System or Not). Thanks a lot Marco. Smile | :)

Nice one, Tadit - It might be even improvable by providing information what the ProgID for the other office applications are (Word etc., but maybe even Visio or MS Project).

Using the Code

We will use Type Class and its method Type.GetTypeFromProgID Method (String).

Gets the type associated with the specified program identifier (ProgID), returning null if an error is encountered while loading the Type.

Return Value

Type: System.Type

The type associated with the specified ProgID, if progID is a valid entry in the registry and a type is associated with it; otherwise, null.

For Word, the ProgID is Word.Application. So, the below code is used to check whether Word is installed or not.

Type officeType = Type.GetTypeFromProgID("Word.Application");

if (officeType == null)
{
    // Word is not installed.
    // Show message or alert that Word is not installed.
}
else
{
    // Word is installed.
    // Continue your work.
}  

History

  • 29 November 2013 - First version submitted

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Software Developer Mindfire Solutions
India India
Proud Indian | Microsoft MVP | CodeProject MVP | Author | Blogger | Community Expert | Moderator | jsfiddler | Cricketer | Cook | Dancer
 
Currently working @Mindfire Solutions.
Love to code and help guys to Trap the Bug.

My Tech Blog

taditdash.wordpress.com

Programming Community Profiles

jsfiddle | Stack Overflow

Other Blog Profiles

Mindfire CRM Team Blog | Mindfire Blog

Social Profiles

Facebook | Twitter | LinkedIn | Google+

Awards

  1. Microsoft MVP 2014
  2. Code Project MVP 2014
  3. Star Achiever of the Month December 2013
  4. Mindfire Techno Idea Contest 2013 Winner
  5. Star of the Month July 2013
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralNice PinmemberDebopam Pal29-Nov-13 9:02 
GeneralRe: Nice PinprofessionalTadit Dash30-Nov-13 6:52 
QuestionMy Vote of 1 PinmemberMacSpudster29-Nov-13 7:04 
When Word is NOT installed, the code fails to appropriately credit the computer user of their significant level of intelligence for having not installed Word and, rather, chose something far better as a word processor.
 
Some loud video of fireworks would be fitting of the occasion. Big Grin | :-D
 
(haha)
 
Nice tip. Thx!
(Yes, I voted 5!)
Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup:
The best way to improve Windows is run it on a Mac.
The best way to bring a Mac to its knees is to run Windows on it.
~ my brother Jeff

AnswerRe: My Vote of 1 PinprofessionalTadit Dash30-Nov-13 6:49 
GeneralMy vote of 5 PinprofessionalMarco Bertschi29-Nov-13 5:41 
GeneralRe: My vote of 5 PinprofessionalTadit Dash30-Nov-13 6:50 
GeneralRe: My vote of 5 PinprofessionalTadit Dash4-Dec-13 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 29 Nov 2013
Article Copyright 2013 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid