none
Can't save the same document for the second time RRS feed

  • Question

  • I Can't save the document for the second time .
    Getting the below error  :
    System.Runtime.Interopservices.COMException (0x800a1420) : this is not a valid file name

    This is my code 
    Word.Document document = Globals.ThisAddIn.Application.ActiveDocument;
    object FilePath = @"E:\\Logs\\temp\\"+document.Name;
    document.SaveAs(ref FilePath,
    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);
    
    object SecondFilePath = @"E:\\Logs\\origin\\"+document.Name;
    document.SaveAs(ref SecondFilePath ,
    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);
    
    
    
    
    

    Sunday, October 7, 2018 4:53 PM

Answers

  • Hi hariharan,

    Based on my tests, your path E:\\Logs\\origin\\ may not exist, and you could manually create the directory , and then run the program.

    Best Regards,
    Bruce

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by hariharan.t Monday, October 8, 2018 6:48 AM
    Monday, October 8, 2018 5:18 AM
    Moderator

All replies

  • Hi hariharan,

    Based on my tests, your path E:\\Logs\\origin\\ may not exist, and you could manually create the directory , and then run the program.

    Best Regards,
    Bruce

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    • Marked as answer by hariharan.t Monday, October 8, 2018 6:48 AM
    Monday, October 8, 2018 5:18 AM
    Moderator
  • Thanks Bruce...! Forget to create the Directory.
    Monday, October 8, 2018 6:48 AM