I'm using the Microsoft.Office.Interop.Excel to open an password protected Excel file from my C++/CLI program. I supply a password as the 5:th argument. When i run my program, Excel starts and open my file but it prompts for password. Note that the file is password protected, not the worksheets.
According to the documentation the password should be of type object but supplying it as a literal should also work?
using namespace System;
using namespace Microsoft::Office::Interop::Excel;
Microsoft::Office::Interop::Excel::Application^ exApp= gcnew Microsoft::Office::Interop::Excel::ApplicationClass();
String^ filename="e:\\test.xls";
Workbook^ wb = exApp->Workbooks->Open(filename, Type::Missing, Type::Missing, Type::Missing, "passw1", Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing, Type::Missing);
Aucun commentaire:
Enregistrer un commentaire