Home > Software engineering >  VC/MFC modify excel password
VC/MFC modify excel password

Time:09-20

Use vc/MFC to write data in excel, now the customer request to excel add password and password can be modified,
1. If the password no problem fixed, open the excel file, write data, save the excel file
2. If the password is changed, I according to (the original password) open the excel file, save (new password) excel file, use the book. The SaveAs storage, whether the password will be modified,
When the actual change passwords found book. Saveas performed, but the password or the original password, depositing data, (the new password) open the excel file, an error tip password mistake,

In the VC and MFC, the need to modify the excel file password, how to do?

Open and close the two sentences respectively as follows:

 book. SaveAs (COleVariant (SaveFileAllPath), covOptional, COleVariant (Test_set_password_temp), covOptional, 
CovOptional, covOptional, covOptional, 1,
CovOptional, covOptional, covOptional, covOptional);


 
LpDisp=books. The Open (SaveFileAllPath, covOptional, covOptional, covOptional, COleVariant (Test_set_password_temp), covOptional
, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional, covOptional,
CovOptional, covOptional);

CodePudding user response:

Try new deposit an EXCEL file, or EXCEL manual recording macros, according to the macro modify the code


CodePudding user response:

So the password storage mechanism must design the
According to a configuration file, or saved to a local database field,

Users can custom modify a local file, or you can program pop-up secondary validate input
(if the password not expressly introduces an encryption mechanism)

CodePudding user response:

Workbook. Unprotect old password
Workbook. Protect the new password
  • Related