Description: Changes the password of an Excel workbook.
Parameters:
ChangePassword(sPathOriginal As String, sPathTarget As String,
sOriginalFilePW As String, sOriginalFilePWToWrite As String,
sTargetFilePW As String, sTargetFilePWToWrite As String) As Long
|
Parameter |
Meaning |
|
sPathOriginal |
Excel file from which to copy the sheet. |
|
sPathTarget |
Excel file to which data is copied. |
|
sOriginalFilePW |
Original file password to open XLS file |
|
sOriginalFilePWToWrite |
Original file password to write within the XLS file |
|
sTargetFilePW |
Target file password to open the XLS file |
|
sTargetFilePWToWrite |
Target file password to write within the XLS file |
Notes: sPathOriginal AND sPathTarget can be the same Excel file, in which case the passwords of the file are changed or removed.
Return Values:
0: Success
-3: Unable to create Excel Application. Is it installed?
-4: Unable to destroy Excel Application.
-200: Excel reported an error
-201: Shareware Expired
-208: Target Path folder does not exist, even after attempting to create it.
Example Code:
This simple example opens "C:\input\A.XLS" and changes its password to open from "Apples" to "Oranges":
lErr = XLSCX.ChangePassword("C:\input\A.XLS", "C:\input\A.XLS", "Apples", "", "Oranges", "")