none
How to open a Excel file protected with password using Microsoft JET??? RRS feed

  • Question

  •  

    Hey people.

     

    I'm trying to open a excel file protected by password using microsoft jet but the code return this error for me: Could not decrypt file.

     

    Code:

     

    int imex1 = 1;

     

    string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +

    "Data Source=" + pStrFile + "; Jet OLEDB:Engine Type=5;" +

    "Extended Properties=\"Excel 8.0;HDR=YES;IMEX=" + imex1 + ";\"";

     

    Im try to put the tag password and pwd in the code and not work.

     

    How i do that???

     

    The support page doesnt help me: http://support.microsoft.com/default.aspx/kb/211378/EN-US/

    Friday, May 9, 2008 8:14 PM

Answers

  • Jet OLEDB does not support password protected Excel files. It is limitation for Jet. If you still need to do this then you could use Office Tools fro Visual Sudio .NET. Thatr library provides access to complete functionality, but it is still COM-based and could be too "heavy" for application. If you want to stay with Jet, you would need to remove passwords.

     

    Sunday, May 11, 2008 8:47 PM
    Moderator

All replies

  • You need to choose one of the methods outlined in the support page. For background information, see http://msdn.microsoft.com/en-us/library/ms971514.aspx. I'd recommend removing the Excel password - it doesn't buy you much in the way of security (the Internet abounds with utilities for bypassing it), and it's a pain to program around, as you've seen. A more robust solution would be to place the Excel file on a secured network share.

     

    --Mary

    Saturday, May 10, 2008 1:42 PM
  • Jet OLEDB does not support password protected Excel files. It is limitation for Jet. If you still need to do this then you could use Office Tools fro Visual Sudio .NET. Thatr library provides access to complete functionality, but it is still COM-based and could be too "heavy" for application. If you want to stay with Jet, you would need to remove passwords.

     

    Sunday, May 11, 2008 8:47 PM
    Moderator
  • Thanks for the help

     

    Tuesday, May 13, 2008 1:41 PM