Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 457617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:35:20+00:00 2026-05-12T22:35:20+00:00

Hi I am creating Spell Checker for my c# application. I am using using

  • 0

Hi I am creating Spell Checker for my c# application. I am using using Microsoft.Office.Interop.Word; dlls but having error.

I have tested my code in VB.Net and it is working fi9 but now I have to c# and having errors in my code

private void SpellOrGrammarCheck(bool blnSpellOnly)
    {

        try
        {
            object objWord;
            object objTempDoc;
            IDataObject iData;

            if (TextBox1.Text == "")
            {
                return;
            }

            objWord = new Microsoft.Office.Interop.Word.Application();
            objTempDoc = objWord.Documents.Add();
            objWord.Visible = false;

            objWord.WindowState = 0;
            objWord.Top = - 3000;

            Clipboard.SetDataObject(TextBox1.Text);

            objTempDoc.Content.Paste();
            objTempDoc.Activate();
            if (blnSpellOnly)
            {
                objTempDoc.CheckSpelling();
            }
            else
            {
                objTempDoc.CheckGrammar();
            }
            objTempDoc.Content.Copy();
            iData = Clipboard.GetDataObject();
            if (iData.GetDataPresent(DataFormats.Text))
            {
                TextBox1.Text = System.Convert.ToString(iData.GetData(DataFormats.Text, System.Convert.ToBoolean(null)));
            }
            objTempDoc.Saved = true;
            objTempDoc.Close();

            objWord.Quit();

            MessageBox.Show("The spelling check is complete.", "Spell Checker", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }
        catch (System.Runtime.InteropServices.COMException)
        {
            MessageBox.Show("Microsoft Word must be installed for Spell/Grammar Check " + "to run.", "Spell Checker");

        }
        catch (Exception)
        {
            MessageBox.Show("An error has occurred.", "Spell Checker");

        }

    }

Object doestnot contain definition of Document. This is error which I am getting on building. I have include Reference of Microsoft.Office.Interop.Word successfully in c#


I tried your suggestion although it is good but didn’t work for me. Now it is throwing new exception that

objTempDoc = objWord.Documents.Add();

Exception : No overload for method Add takes ‘0’ arguments.

Any suggestion ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:35:21+00:00Added an answer on May 12, 2026 at 10:35 pm

    C# does not support late binding. You must declare objWord as Microsoft.Office.Interop.Word.Application instead of object. Dito for objTempDoc (whatever type Documents.Add returns).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 223k
  • Answers 223k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, let x be a vector with NaN for the… May 13, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer It's the stacking order a bit like the CSS z-index… May 13, 2026 at 12:33 am
  • Editorial Team
    Editorial Team added an answer View from 30,000 feet: First, you'll need to figure out… May 13, 2026 at 12:33 am

Related Questions

I decide to learn more about vim and its syntax highlighting. Using examples for
Hi I am creating a tab bar controller in xcode and not in interface
Hi I am creating a listbox containing 2 text boxes each time a user
Hi I am creating the application which creates the excel file pro grammatically. Now
Hi I'm having trouble compiling a simple piece of code. I am creating a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.