Word 2007 Automation error 800a1066 on document.saveas RRS feed

  • Question

  • User-1279022963 posted


    I'm running vista enterprise and visual studio 2005 with Office 2007.

    I'm trying to do word automation under asp.net using vb.net.

    I can create a document using the following code..

     Dim oDoc As Word.Document

    oDoc = New Word.Document

     oDoc.SaveAs(HttpContext.Current.Server.MapPath( "/Flyer") & "\" & "lala.doc")

    I get the error command failed. Com execption on the saveas line.

     The folder does exist. I have given every account I can think of permission on the entire IIS folder tree.

     I can manually save a document there from word. I have impersonation using my own account which is a domain admin and local admin on the box. Visual Studio 2005 is running as an admin. UAC is turned off. Word opens fine for me without any popups.

     I use virtually identical code to create and save a document on a windows 2003 server with word 2003, but try as I might I cannot get past this error on my development machine. As the document won't save I can't do any further development as I won't know what it looks like hehe.

     Winword appears in task manager with my username next to it when the page runs. Any ideas ... I'm going mad here :)

    Thanks for any help


    Wednesday, October 14, 2009 12:49 PM

All replies

  • User544512917 posted

    When at runtime you put a breakpoint on the oDoc.SaveAs(... line, try adding a watch to inspect the value of

    HttpContext.Current.Server.MapPath( "/Flyer") & "\" & "lala.doc"

    What value does that expression have? Can you post it?

    Wednesday, October 14, 2009 5:22 PM