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. General Programming
  3. C / C++ / MFC
  4. Error 5151 creating Word document

Error 5151 creating Word document

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++sysadminwindows-adminquestion
5 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.
  • E Offline
    E Offline
    EnkelIk
    wrote on last edited by
    #1

    Hello! I have an older C++ application that uses the Word.Application object to create and open a Word document from a template. I have installed my application on a new server running Windows server 2008 (32bit) and now the Word-connection gives me trubble, Word starts an instance but no document is created and I recieve the error: 5151 Word was unable to read this document. It may be corrupt. Try one or more of the following: * Open and Repair the file. * Open the file with the Text Recovery converter. The application works fine when I run it on my computor (XP 32bit) as well as on a Win 2008 64bit server (and various Win 2003 32-bit servers). I think there is some problem when creating and loading the Normal.dotm-file but there is no problem opening the template in Word nor opening the Normal.dotm-file that is created. I tried Repair as well as uninstalling and reinstalling Office 2007. Any ideas? Thanks!

    D E 2 Replies Last reply
    0
    • E EnkelIk

      Hello! I have an older C++ application that uses the Word.Application object to create and open a Word document from a template. I have installed my application on a new server running Windows server 2008 (32bit) and now the Word-connection gives me trubble, Word starts an instance but no document is created and I recieve the error: 5151 Word was unable to read this document. It may be corrupt. Try one or more of the following: * Open and Repair the file. * Open the file with the Text Recovery converter. The application works fine when I run it on my computor (XP 32bit) as well as on a Win 2008 64bit server (and various Win 2003 32-bit servers). I think there is some problem when creating and loading the Normal.dotm-file but there is no problem opening the template in Word nor opening the Normal.dotm-file that is created. I tried Repair as well as uninstalling and reinstalling Office 2007. Any ideas? Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Are you using an #import directive with a specific version of Word?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      E 1 Reply Last reply
      0
      • D David Crow

        Are you using an #import directive with a specific version of Word?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        E Offline
        E Offline
        EnkelIk
        wrote on last edited by
        #3

        From what I can tell there is no connection to a specific version of Word. The same version of Word is running on the server where I get the error as on my computer and on the other server where I don't get the error...

        E 1 Reply Last reply
        0
        • E EnkelIk

          From what I can tell there is no connection to a specific version of Word. The same version of Word is running on the server where I get the error as on my computer and on the other server where I don't get the error...

          E Offline
          E Offline
          EnkelIk
          wrote on last edited by
          #4

          By the way - the application can create and open Excel-documents without problems on the same server and the application is run interactively by a logged on user. The error occurs no matter whether the user has administrator rights or just "normal" user rights to the server.

          modified on Monday, February 22, 2010 10:11 AM

          1 Reply Last reply
          0
          • E EnkelIk

            Hello! I have an older C++ application that uses the Word.Application object to create and open a Word document from a template. I have installed my application on a new server running Windows server 2008 (32bit) and now the Word-connection gives me trubble, Word starts an instance but no document is created and I recieve the error: 5151 Word was unable to read this document. It may be corrupt. Try one or more of the following: * Open and Repair the file. * Open the file with the Text Recovery converter. The application works fine when I run it on my computor (XP 32bit) as well as on a Win 2008 64bit server (and various Win 2003 32-bit servers). I think there is some problem when creating and loading the Normal.dotm-file but there is no problem opening the template in Word nor opening the Normal.dotm-file that is created. I tried Repair as well as uninstalling and reinstalling Office 2007. Any ideas? Thanks!

            E Offline
            E Offline
            EnkelIk
            wrote on last edited by
            #5

            After placing a number of printouts down in the class using the Word.Application objekt I found out that the error occured doing Documents.Add(@"\\path\OurTemplate"), there seems to be some filetype association missing on the server which is in place on the other servers where the same code works fine. Changing to Documents.Add(@"\\path\OurTemplate.dot"), i.e. explicitly specifying the file suffix solved the problem. Why the suffix was not supplier from the begining I can't say - this code was written long before my time here...

            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