LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Open Excel File With Password

Hi

 

How do i open an Excel file that is protect by a password using the activex?

I would like my program to open the file and insert the password automatically.

Help share your knowlegde
0 Kudos
Message 1 of 2
(3,415 Views)

Found the solution.

You first need to get the Workbooks handle then open it using Excel_WorkbooksOpen.

In Excel_WorkbooksOpen you then place the password in the right parameter and voila it opens the excel file the has a password.

You would obviously have to know the password.

 


Excel_GetProperty (ExcelApp, NULL, Excel_AppWorkbooks,
CAVT_OBJHANDLE, &hWorbooks);
Excel_WorkbooksOpen (hWorkbooks, NULL,
"c:\\\\/.xls",
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, ExcelPassword,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,

CA_DEFAULT_VAL, CA_DEFAULT_VAL,
&hWorkbook);

Help share your knowlegde
0 Kudos
Message 2 of 2
(3,408 Views)