Page 1 of 1
How do you test an Excel password
Posted: Fri Jul 02, 2010 10:20 am
by Jeanne
I need to test the Excel Password to make sure it will work without just aboring. If the password is correct then all if good but I can not figure out how to test it. If the password is correct this will open the file then close it.. how would I go about testing it?
Jeanne
Code: Select all
oExcel := CreateObject("Excel.Application")
oExcel:Visible := .f.
oBook := oExcel:Workbooks:Open(cExcelFile,,,,cPassword)
// do something with the open file
oBook:close()
oBook:destroy()
oExcel:Quit() // Quit Excel
oExcel:Destroy()
Re: How do you test an Excel password
Posted: Sun Jul 04, 2010 4:51 pm
by Auge_Ohr
Jeanne wrote:I need to test the Excel Password to make sure it will work without just aboring. If the password is correct then all if good but I can not figure out how to test it. If the password is correct this will open the file then close it.. how would I go about testing it?
what about using BEGIN / SEQUENCE ?
see reply in Alaska Newsforum, public.xbase++.activex, "re: validate Excel password", 5. Juli 2010
Re: How do you test an Excel password
Posted: Tue Jul 06, 2010 8:03 am
by Jeanne
I thought that sounded like a great ideal. But when I did it I got the Microsoft Excel spread sheet with the Microsoft password prompt popup behind my application. You could not see the Microsoft password prompt until you clicked on the Excel window. This is not the way I was hoping to handle this issue. I want to handle the password issue myself in my application.
Re: How do you test an Excel password
Posted: Tue Jul 06, 2010 7:20 pm
by Auge_Ohr
Jeanne wrote:You could not see the Microsoft password prompt until you clicked on the Excel window. This is not the way I was hoping to handle this issue. I want to handle the password issue myself in my application.
so it is not "your" Xbase++ Password Dialog ?
Code: Select all
or "search" in Tasklist to bring it ":toFront()"
this is for Xbase++ Dialog too, but if your M$ Password Dialog is shown in Tasklist (must have a Title) than you can "switch" to it !
Code: Select all
DLLFUNCTION ShowWindow( nHwnd, nCmdShow ) USING STDCALL FROM USER32.DLL
DLLFUNCTION BringWindowToTop( nHwnd ) USING STDCALL FROM USER32.DLL
DLLFUNCTION SetForegroundWindow( nHwnd ) USING STDCALL FROM USER32.DLL
shoud help you.