Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi,
I'm trying to save a document from a web click as described in the knowledge base article. http://support.microsoft.com/kb/316384/EN_US Instead of using Windows Application I use web application asp button to do the work. I'm trying to save the document. However, both save and saveAs doesn't not work for some reason. Here is the code for save: object fileName = "c:\\MyNewDocument.doc"; oWord.Documents.get_Item(ref fileName).Save(); It gives me this error:System.Runtime.InteropServices.COMException: Bad file name When I try to use saveAs as follow: oDoc.SaveAs(ref fileName, ref missingValue,ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue, ref missingValue,ref missingValue, ref missingValue); It hangs forever and does not go through. Thanks for the help in advance Koala |
#2
![]() |
|||
|
|||
![]()
Hi ?B?a29hbGE=?=,
Note that you've posted in an end-user group, and the chances of getting a reply to a C# question are vanishingly remote. You should be posting in an office.developer newsgroup. But see below... Instead of using Windows Application I use web application asp button to do the work. I'm trying to save the document. However, both save and saveAs doesn't not work for some reason. Here is the code for save: object fileName = "c:\\MyNewDocument.doc"; oWord.Documents.get_Item(ref fileName).Save(); It gives me this error:System.Runtime.InteropServices.COMException: Bad file name I'm a bit vague with this in C#; I know that sometimes you need to specify double backslashes in order to get a single one in the result; other times not. Do you have any way of testing whether what's getting passed through ref fileName contains single or double backslashes? Word will accept only one... And, generally, you'd refer to an open document with only the file name (and not the full path). You might want to see if Word accepts that. You might also see if oWord.Documents[1].Save will work - just to test whether save is working at all. Cindy Meister INTER-Solutions, Switzerland http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004) http://www.word.mvps.org This reply is posted in the Newsgroup; please post any follow question or reply in the newsgroup and not by e-mail :-) |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual basic runtime error 5216, there is a printer error | Microsoft Word Help |