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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. System.Runtime.InteropServices.COMException: Cannot activate application

System.Runtime.InteropServices.COMException: Cannot activate application

Scheduled Pinned Locked Moved ASP.NET
helpsysadminasp-netdatabasecom
8 Posts 2 Posters 2 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.
  • V Offline
    V Offline
    vikash_singh
    wrote on last edited by
    #1

    hi guys please help me ! iam using "Microsoft.Office.Interop.Word.ApplicationClass" for exporting data from DB to word document. it works fine on server where i published the application. but from my machine is shows the following error:-"System.Runtime.InteropServices.COMException: Cannot activate application" code is....... public static bool Export( string questionID, int questionNumber, object filename ) try { bool result=false; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add( ref missing, ref missing, ref missing, ref missing ); ................... wordApp.Selection.TypeParagraph(); wordDoc.SaveAs( ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing ); wordDoc.Close( ref missing, ref missing, ref missing ); wordApp.Application.Quit( ref missing, ref missing, ref missing ); return result; } -------------------- 1. already i configured security setting for word in DCOMcnfg(added network service, aspnet and set access permission to full control and rebooted the system) though iam getting the same error. 2. i changed application platform to x86 still problem continues..... waiting for help ! thanx

    A 1 Reply Last reply
    0
    • V vikash_singh

      hi guys please help me ! iam using "Microsoft.Office.Interop.Word.ApplicationClass" for exporting data from DB to word document. it works fine on server where i published the application. but from my machine is shows the following error:-"System.Runtime.InteropServices.COMException: Cannot activate application" code is....... public static bool Export( string questionID, int questionNumber, object filename ) try { bool result=false; object missing = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass(); Microsoft.Office.Interop.Word.Document wordDoc = wordApp.Documents.Add( ref missing, ref missing, ref missing, ref missing ); ................... wordApp.Selection.TypeParagraph(); wordDoc.SaveAs( ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing ); wordDoc.Close( ref missing, ref missing, ref missing ); wordApp.Application.Quit( ref missing, ref missing, ref missing ); return result; } -------------------- 1. already i configured security setting for word in DCOMcnfg(added network service, aspnet and set access permission to full control and rebooted the system) though iam getting the same error. 2. i changed application platform to x86 still problem continues..... waiting for help ! thanx

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Code looks good. Do you have the same version of office installed? Is it Office 2007 installed in your machine?

      Abhishek Sur My Latest Articles Working with Excel using MDAC
      Basics on LINQ and Lambda Expressions
      Create .NET Templates

      V 1 Reply Last reply
      0
      • A Abhishek Sur

        Code looks good. Do you have the same version of office installed? Is it Office 2007 installed in your machine?

        Abhishek Sur My Latest Articles Working with Excel using MDAC
        Basics on LINQ and Lambda Expressions
        Create .NET Templates

        V Offline
        V Offline
        vikash_singh
        wrote on last edited by
        #3

        yes, we installed ms-office 2007

        V 1 Reply Last reply
        0
        • V vikash_singh

          yes, we installed ms-office 2007

          V Offline
          V Offline
          vikash_singh
          wrote on last edited by
          #4

          i removed worddoc.active() function from code bcoz it was showing error in server. so now after publishing i am getting new error.... error is:---

          System.Runtime.InteropServices.COMException: Word has encountered a problem.

          A 1 Reply Last reply
          0
          • V vikash_singh

            i removed worddoc.active() function from code bcoz it was showing error in server. so now after publishing i am getting new error.... error is:---

            System.Runtime.InteropServices.COMException: Word has encountered a problem.

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            Hey..Is it the same old problem with Word Templates being corrupted. Open word manually and see.. if it crashes or not. If it is the same problem, then you need to get Normal.dot file and replace it with your one. :doh:

            Abhishek Sur My Latest Articles Working with Excel using MDAC
            Basics on LINQ and Lambda Expressions
            Create .NET Templates

            V 1 Reply Last reply
            0
            • A Abhishek Sur

              Hey..Is it the same old problem with Word Templates being corrupted. Open word manually and see.. if it crashes or not. If it is the same problem, then you need to get Normal.dot file and replace it with your one. :doh:

              Abhishek Sur My Latest Articles Working with Excel using MDAC
              Basics on LINQ and Lambda Expressions
              Create .NET Templates

              V Offline
              V Offline
              vikash_singh
              wrote on last edited by
              #6

              Thanks for suggestion i tried what u said but MS-word(open, create, save) is working fine on server and in web app export/import using localhost is also working smoothly on server. every thing is ok but when the same web app accessed from my local machine it shows the following error.

              System.Runtime.InteropServices.COMException: Word has encountered the problem

              V 2 Replies Last reply
              0
              • V vikash_singh

                Thanks for suggestion i tried what u said but MS-word(open, create, save) is working fine on server and in web app export/import using localhost is also working smoothly on server. every thing is ok but when the same web app accessed from my local machine it shows the following error.

                System.Runtime.InteropServices.COMException: Word has encountered the problem

                V Offline
                V Offline
                vikash_singh
                wrote on last edited by
                #7

                hey it's working yaar ! i placed "identity" tab with property "imposonate=true" in web.config and it's working fine

                1 Reply Last reply
                0
                • V vikash_singh

                  Thanks for suggestion i tried what u said but MS-word(open, create, save) is working fine on server and in web app export/import using localhost is also working smoothly on server. every thing is ok but when the same web app accessed from my local machine it shows the following error.

                  System.Runtime.InteropServices.COMException: Word has encountered the problem

                  V Offline
                  V Offline
                  vikash_singh
                  wrote on last edited by
                  #8

                  hey it's working yaar ! i placed

                  "identity" tab with property "imposonate=true",username="XXX" password="XXX">

                  in web.config and it's working fine

                  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