Subject: Open workbook using macro
Posted By: rekha_jsr Post Date: 6/22/2005 2:06:00 AM
Hi all,

I m new to excel Macro. I just want to write a macro in excel sheet which will ask user id and pawssword from the user and after verifying the data form the database it will open a workbooks("abc.xla") with selected worksheet.

Pl Help

It is always safe to assume, not that the old way is wrong, but that there may be a better way...
*************************
Rekha
Reply By: kari Reply Date: 4/18/2006 2:07:57 AM
Hi Rekha,

Maybe you can create a UserForm as a form for user to insert her/his name and password.
To make a UserForm you go to Tools -> Macro -> VBEditor
then in the Project window right click and choose insert User Form and then you can design the User Form as you want.

In the Thisworkbook. You create a sub:

Private Sub Workbook_Open()
UserForm1.Show
End Sub

To call the user form you have created.

Then you can verify the name and password of the user and decided where is the worksheet that should be visible and where is not.
If the name and password is not matching you can close the excel application



Reply By: samir_katore Reply Date: 4/19/2006 5:40:42 AM
Hi Rekha i like your slogen.
for your probelm i will say that on sheet put a Button and Assign a macro to it. But first Create a macro which will take User Id and Password from opened sheet. simply from cell of excell. then verify it against databse. if password is ok then open excel sheet which you want to open.

for opening excel you can use
dim sa
sa=shell(<office path for excel.exe>\excel.exe ,<drive path>\<book1.xls>)
this will open excel sheet.

Bye

samir

Go to topic 43027

Return to index page 310
Return to index page 309
Return to index page 308
Return to index page 307
Return to index page 306
Return to index page 305
Return to index page 304
Return to index page 303
Return to index page 302
Return to index page 301