How do you test an Excel password

This forum is for eXpress++ general support.
Post Reply
Message
Author
Jeanne
Posts: 34
Joined: Thu Jan 28, 2010 8:11 am
Location: Oklahoma, USA
Contact:

How do you test an Excel password

#1 Post 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()

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: How do you test an Excel password

#2 Post 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
greetings by OHR
Jimmy

Jeanne
Posts: 34
Joined: Thu Jan 28, 2010 8:11 am
Location: Oklahoma, USA
Contact:

Re: How do you test an Excel password

#3 Post 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.

User avatar
Auge_Ohr
Posts: 1422
Joined: Wed Feb 24, 2010 3:44 pm

Re: How do you test an Excel password

#4 Post 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.
greetings by OHR
Jimmy

Post Reply