My C# program hit the error "Word cannot load the OLE 2.0 or Docfile library"

Daniel Xiao Dan 6 Reputation points
2021-06-09T09:45:07.35+00:00

I am writing a piece of C# codes to open a Microsoft Word application, as shown below:

................................................................................................................................................................................................................................
Microsoft.Office.Interop.Word._Application wordApp = new Word.Application();
................................................................................................................................................................................................................................

But the C# codes hit the error message "Word cannot load the OLE 2.0 or Docfile library" (see the screenshot below)
103804-word-cannot-load-the-ole20-or-docfile-library.jpg

Can anybody help to provide a solution to this issue? Do I need to install the latest update of Microsoft Word 16.0? Or even do I need to re-install Microsoft Office?

Thank you.

Rgds,
Daniel

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,308 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.
897 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Dan Xiao 406 Reputation points
    2021-06-13T11:50:10.587+00:00

    Hi, DuaneArnold-0443,

    I have tried to uninstall & reinstall the latest version Microsoft Office 365, but the issue is still persisting.

    Actually I have googled some websites, but most posts are applicable to Mac OS or iMac environment, but my computer is based on Windows 10. Some posts advise to uninstall & reinstall Microsoft Office, which I have done already. Therefore they are basically helpless.

    Below I give you some examples of the googled URLs:

    https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_mac-mso_mac2016/error-message-opening-word-cannot-load-ole-20-or/bcbfd38b-4c13-44ee-a079-220c65ecd194
    https://www.windowsphoneinfo.com/threads/error-word-cannot-load-the-ole-2-0-or-docfile-libraries.308237/
    https://www.justanswer.com/mac-computers/fxyc3-a-cannot-load-ole-2-0-docfile-libraries-shows.html
    https://www.justanswer.com/mac-computers/fxyj2-2nd-opinion-not-close-cannot-load-ole-2-0-docfile.html
    https://discussions.apple.com/thread/251693944

    Can u please kindly try to provide some solutions to this issue?
    Thanks.

    Rgds,
    Daniel

    1 person found this answer helpful.
    0 comments No comments

  2. Duane Arnold 3,216 Reputation points
    2021-06-09T14:29:29.607+00:00

    I would say take the error message and search Bing or Google on what others have done to resolve the issues. You are not the only one that has faced the issue. I would also find out how to install the two items your program is looking for use Bing or Google.

    0 comments No comments