Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem while opening MS-Word files using APIs

Problem while opening MS-Word files using APIs

Scheduled Pinned Locked Moved ASP.NET
helpcomsysadminwindows-adminjson
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abhishek Joshi
    wrote on last edited by
    #1

    Hi, I am facing problem of COMException while opening MS-Word files using on
    Windows Server 2003. I am refering Interop.Word.dll for opening MS-Word files to count the
    number of words from it. I am using following API to open the doc files.

    Word.ApplicationClass wordApp = null;
    Word.Document aDoc = null;
    aDoc = wordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,
    ref missing, ref missing, ref missing, ref missing);
    aDoc.Activate();

    If I deploy above code on
    Windows 2000 professional then it works without error but if I deploy same code on Windows Server 2003 then I get following exception.

    System.Runtime.InteropServices.COMException (0x800A1066): Command failed at
    Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,
    Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument,
    Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible,
    Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)

    Please tell me solution for it. -- modified at 2:43 Saturday 19th May, 2007

    #Abhi#

    K 1 Reply Last reply
    0
    • A Abhishek Joshi

      Hi, I am facing problem of COMException while opening MS-Word files using on
      Windows Server 2003. I am refering Interop.Word.dll for opening MS-Word files to count the
      number of words from it. I am using following API to open the doc files.

      Word.ApplicationClass wordApp = null;
      Word.Document aDoc = null;
      aDoc = wordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing,
      ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible,
      ref missing, ref missing, ref missing, ref missing);
      aDoc.Activate();

      If I deploy above code on
      Windows 2000 professional then it works without error but if I deploy same code on Windows Server 2003 then I get following exception.

      System.Runtime.InteropServices.COMException (0x800A1066): Command failed at
      Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,
      Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument,
      Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible,
      Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)

      Please tell me solution for it. -- modified at 2:43 Saturday 19th May, 2007

      #Abhi#

      K Offline
      K Offline
      koolprasad2003
      wrote on last edited by
      #2

      Dear Abhi Have u refer microsoft.office 11.0 library ? if not then refer it and then try on win server2003 best regards, koolprasad2003:)

      Be A Good S/W Eng... Life is swing with you..Enjoy..

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups