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

  • SEARCH
  • Home
  • 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 8691613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:09:14+00:00 2026-06-13T00:09:14+00:00

I recently posted a question about reading Word files here . The app runs

  • 0

I recently posted a question about reading Word files here.

The app runs fine however I get this Warning message;

Warning Ambiguity between method
‘Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)’
and non-method ‘Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close’. Using
method group.

There seems to be some ambiguity from some using namespace and I would like to know how to resolve this. Although the app runs, I would like to minimize warning/errors.

I have provided the code below for the class; The line it refers to are these two lines

docs.Close(ref nullobject, ref nullobject, ref nullobject);
wordObject.Quit(ref nullobject, ref nullobject, ref nullobject);

The whole code:

namespace Wizard.Classes
{
    class MSWordReader
    {
        public void read(String filename)
        {
            String buffer = "";
            try
            {
                Microsoft.Office.Interop.Word.Application wordObject = new   
                Microsoft.Office.Interop.Word.Application();
                object file = filename; //this is the path
                object nullobject = Type.Missing;
                object visible = false;
                object readonlyp = true;
                object addtorecent = false; //add to words recent filelist

                Microsoft.Office.Interop.Word.Document docs = wordObject.Documents.Open
                    (ref file,ref nullobject, ref readonlyp, ref addtorecent,
                    ref nullobject, ref nullobject, ref nullobject, ref nullobject,
                    ref nullobject, ref nullobject, ref nullobject, ref visible,
                    ref nullobject, ref nullobject, ref nullobject, ref nullobject
                                    );
                docs.ActiveWindow.Selection.WholeStory();
                docs.ActiveWindow.Selection.Copy();
                IDataObject data = Clipboard.GetDataObject();
                buffer = data.GetData(DataFormats.Text).ToString();

                docs.Close(ref nullobject, ref nullobject, ref nullobject);

                wordObject.Quit(ref nullobject, ref nullobject, ref nullobject);
                MessageBox.Show(buffer);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
  • 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-06-13T00:09:15+00:00Added an answer on June 13, 2026 at 12:09 am

    To resolve the ambiguity, use:

    ((Microsoft.Office.Interop.Word._Document)docs).Close(ref nullobject, ref nullobject, ref nullobject);    
    ((Microsoft.Office.Interop.Word._Application)wordObject).Quit(ref nullobject, ref nullobject, ref nullobject);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently posted a question here about some memory issues I was having. I've
I've recently posted a general question about RAII at SO . However, I still
I recently posted this question about codes for a gift-card-like voucher that users can
Recently this question was posted about the definition of what a transaction is in
(This question is similar to the one I recently posted here except that now
I recently posted a question about screen rotation in my live wallpaper. To test
I recently posted a question about centering a page with CSS. I figured out
I recently posted a question about getting a NullPointerException whenever I called an array
As demonstrated in this answer I recently posted, I seem to be confused about
I recently posted a question about getting last 3 results in table in the

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.