none
File not Found RRS feed

  • Question

  • Hi,

    I am trying to open word document like this..

     object missing = Missing.Value;
                    object fullFilePath = GeneratedFileName;
    //@"F:\Lsoft Technologies\1020\01 Physics\30-Aug-2012\1020000101112233250512.rtf"; 
                    object encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
                    object noEncodingDialog = true;
                    Word._Document myDoc = oWord.Documents.Open(ref fullFilePath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref encoding, ref missing, ref missing, ref missing, ref noEncodingDialog, ref missing);
    

     

    but it gives me an error file not found in specified location but when i am debugging then 

    GeneratedFileName

    it gives me path like ..

    F:\Lsoft Technologies\1020\01 Physics\30-Aug-2012\1020000101112233250512.rtf

    when i copy and paste this url to my search it will open the file.

    confused what happens..

    can anybody help me...Thanks in advance.


    Experience the innovation with perfection.

    Thursday, August 30, 2012 11:48 AM

Answers

  • Hi Bhagawat,

    Ok, let's check out your issue again. I think the reason may be that  the filename "F:\Lsoft Technologies\1020\01 Physics\30-Aug-2012\1020000101112233250512.rtf" contains a space. In the mean time, I would recommend this thread

    http://support.microsoft.com/kb/128959

    Please read it and you will get the cause and resolution for the error message. Hope you can get it working to resolve your issue.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 3, 2012 8:01 AM
    Moderator

All replies

  • I am getting file path like this... while debug

    {"This file could not be found.\r (\"F:\\...\\1020000101112233250512.rtf\")"}


    Experience the innovation with perfection.

    Friday, August 31, 2012 4:41 AM
  • Hi Bhagawat,

    Thank you for posting in the MSDN Forum.

    Based on your issue, I don't think there is problem in your code. It's much possible that the exception occurs due to an error url. If you have verified the file exists in your computer, please try this code to check the url in the object fullFilePath.

    object missing = Missing.Value;
    object fullFilePath = @"F:\Lsoft Technologies\1020\01 Physics\30-Aug-2012\1020000101112233250512.rtf"; 
    object encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
    object noEncodingDialog = true;
    Word._Document myDoc = oWord.Documents.Open(ref fullFilePath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref encoding, ref missing, ref missing, ref missing, ref noEncodingDialog, ref missing)

    Hope this helps.

    If there is any progress, pleaes do not hesitate to let me know.

    Have a good day.


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, August 31, 2012 5:27 AM
    Moderator
  • Hi Leo_Gao,

     I have tried this it works well (in hard code), rather than using hard code if i go for 

    object fullFilePath = GeneratedFileName;

    it give me an error

    {"This file could not be found.\r (\"F:\\...\\1020000101112233250512.rtf\")"}


    Experience the innovation with perfection.

    Friday, August 31, 2012 5:33 AM
  • Hi Bhagawat,

    In terms of your last post, I think the GeneratedFileName may not be able to direct the right url. Could you have a try to debug this object? Alternatively, share some snippets of the GeneratedFileName in the forum for further research.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, August 31, 2012 5:59 AM
    Moderator
  • Hi, see the images

    Experience the innovation with perfection.

    Friday, August 31, 2012 6:19 AM
  • Hi,

    Based on my experience, the problem should be that there is a wrong url or the file doesn't exist. Please have a double-check it.

    Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, August 31, 2012 7:48 AM
    Moderator
  • Hi Leo_Gao,

    I am confused  really when i am copy the fullFilePath and paste into Explore. It will open the file.

    Don't know what's going wrong. but in exception it gives me error like

    {"This file could not be found.\r (\"F:\\...\\1020000101112233250512.rtf\")"}


    Experience the innovation with perfection.

    Friday, August 31, 2012 8:49 AM
  • Hi Bhagawat,

    Ok, let's check out your issue again. I think the reason may be that  the filename "F:\Lsoft Technologies\1020\01 Physics\30-Aug-2012\1020000101112233250512.rtf" contains a space. In the mean time, I would recommend this thread

    http://support.microsoft.com/kb/128959

    Please read it and you will get the cause and resolution for the error message. Hope you can get it working to resolve your issue.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 3, 2012 8:01 AM
    Moderator
  • Hi Leo_Gao,

    Thanks for reply... Space is get the cause to find path. when i tried like this

    "F:\LsoftTechnologies\1020\01Physics\30-Aug-2012\1020000101112233250512.rtf"

    It's work's fine. is their is another solution for this. 


    Experience the innovation with perfection.

    Wednesday, September 5, 2012 9:31 AM
  • Hi Bhagawat,

    I think it's the best workaround for this issue.

    Thanks,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Monday, September 10, 2012 1:35 AM
    Moderator