+ Reply to Thread
Results 1 to 13 of 13

Depanted of the UserName and Password when a workbook is opened.

  1. #1
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Depanted of the UserName and Password when a workbook is opened.

    Hello

    What i mean in my title is this.

    When i open a workbook i need to ask a username and a password. If the use type as UserName "Maria" and Password 123, then a welcome message should appear and open userform1 in sheet1.

    If user type as UserName " John" and Password 589, then code should delete all data in sheets, "one", "two",five" and THEN a welcome message should appear and open userform1 in sheet1.

    Can you help me on this?

    Thanks in advance for any assistance!
    Last edited by MariaPap; 12-20-2013 at 04:17 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Depanted UserName and Password when a workbook is opened.

    What does "depanted" mean?

  3. #3
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Re: Depanted of the UserName and Password when a workbook is opened.

    "Depanted " means that if the user chooses, UserName "Maria" and Password 123,then do this OR if the user chooses " John" and Password 589, then do something else. Sorry for my English.

    "When i open a workbook i need to ask a username and a password. If the user type as UserName "Maria" and Password 123, then a welcome message should appear and open userform1 in sheet1.

    If user type as UserName " John" and Password 589, then code should delete all data in sheets, "one", "two",five" and THEN a welcome message should appear and open userform1 in sheet1."

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Depanted of the UserName and Password when a workbook is opened.

    Ah right, got you, the word you're after is dependant

    Must it have a password? Generally these types of things are easier if you just look at who is currently logged onto the computer and use that instead of having to keep a password also.

  5. #5
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Re: Depanted of the UserName and Password when a workbook is opened.

    Thank you of looking on my problem and also for the English Lessons!!

    What i need is this. If for any reason someone "force" me to open this workbook even that i don't want to see my data, i'll give him-her the second password. Then Data in sheets one, two, five, will automatically deleted and he-she will see only the data of the other sheets which is ok for me...

    I hope this to be more clear.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Depanted of the UserName and Password when a workbook is opened.

    just a thought, if she/he forces you to save the file? what do you do? have you got a plan "b"?!
    or another approach maybe
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  7. #7
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Re: Depanted of the UserName and Password when a workbook is opened.

    Yes. My idea is when workbook is opened using

    Please Login or Register  to view this content.
    the userform3 which will asks for username & password will appears.

    As userform is opened clicking the save button nothing saved. So you have to close this userform. When this userform is closed without to type the correct username & password, data in sheets one,two.five, will automatically deleted.

    Ok. Then they can force me to save the file.

    So any suggestions John?

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Depanted of the UserName and Password when a workbook is opened.

    As you know i am not a VBA expert but i am Greek!!-Same way of thinking-

    I don't know how to compine 2 text boxes for using Username and password.. but here is what i can do..

    In UserForm3 Create a text box1 that will be the place that will type your password. Also a Command Button for confirming this,

    Then try this...

    Please Login or Register  to view this content.
    I hope that someone vba expert will be able to make it better.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  9. #9
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Re: Depanted of the UserName and Password when a workbook is opened.

    If you were a VBA expert, what would happen...?

    Mr Foti, this works great. I don't know if any of the repliers has a better idea, but this works exactly as i expected!

    Thanks for one more time! I don't mark this as solved for a while-in case that someone else would be able to make another suggestion!

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Depanted of the UserName and Password when a workbook is opened.

    As an option, UserForm1 is for UserName and Password having 2 TextBoxes and a CommandButton, UserForm2 is just another UserForm, try to incorporate/adapt it in your file.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  11. #11
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Depanted of the UserName and Password when a workbook is opened.

    Maria.

    Reading John's post, i hope to understand that this is a proffesional approach and mine not!!

    John one point is that when the user leave the 2 textboxes empties, the the order of your code is to save the book and exit! Correct?

    If yes, how can we handle the point that after clicking the button appears the custom form of excel asking if we want to save it or...or cancel...?

    Edit: Actually the message is for all the workbooks that are in use.
    Last edited by Fotis1991; 12-20-2013 at 08:27 AM. Reason: Edit

  12. #12
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Depanted of the UserName and Password when a workbook is opened.

    Fotis, thx but it's not a professional approach at all, it's just an option! the file is not saved, it just makes it look like it's saved.

  13. #13
    Forum Contributor MariaPap's Avatar
    Join Date
    10-19-2013
    Location
    Chania-Crete-Greece
    MS-Off Ver
    Excel 2003-2010
    Posts
    319

    Re: Depanted of the UserName and Password when a workbook is opened.

    That's great John! Thank you.

    Thanks to all three of you(Kyle 123, for English lesson too!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Use a macro to extract cell data from opened workbook to new opened workbook
    By BrianTFC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2014, 01:35 PM
  2. [SOLVED] Username and Password Form - Show Username in Sheet
    By ryan180 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2013, 07:06 PM
  3. How to get the username who opened the excel sheet in a network
    By vijaykumar.madi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2012, 08:25 AM
  4. username/password
    By nicmarty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2007, 06:58 PM
  5. [SOLVED] IE prompts for username and password when saving excel file opened in IE
    By dpbustos@gmail.com in forum Excel General
    Replies: 0
    Last Post: 04-20-2006, 11:45 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1