Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 23

Thread: Password in Macro

  1. #1

    Thumbs up Password in Macro

    Hi

    can i put password to run macro,
    i.e. macro can not be run untill i supply password


  2. #2
    VBAX Regular
    Joined
    Jun 2005
    Location
    Stoke on Trent, Staffordshire, United Kingdom
    Posts
    10
    Location
    I don't think the security settings in Office are flexible enough for this.

    However, you can write your own (obviously you'll need to password protect your project so casual users won't be able to hack your code)!

    If you set up a form with a textbox in there, there is a property called PasswordChar which you can set (to '*' or somesuch) which you can then check against using whatever encryption you may or may not choose to use.

    Full instructions and a more detailed account can be found here:

    http://support.microsoft.com/default...b;en-us;212708

    Hope this is of some help.

  3. #3
    No u did not got me,
    i want user to give password for running given macro as supplied while opening protected excel file
    so data is not modified by unauthorised person

  4. #4
    VBAX Mentor Justinlabenne's Avatar
    Joined
    Jul 2004
    Location
    Clyde, Ohio
    Posts
    408
    Location
    1) Excel is not secure. If someone wants at your workbook. They can probably get it.

    2) Try this to get you started. Very cheap, basic example.
    Justin Labenne

  5. #5
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Simple and yet useful.....Can we hide the sheet when the dialog box for password is shown? Because ppl can see the data in sheet before entering data......


    Thx in advance,

  6. #6
    VBAX Mentor Justinlabenne's Avatar
    Joined
    Jul 2004
    Location
    Clyde, Ohio
    Posts
    408
    Location
    Like this?
    Justin Labenne

  7. #7
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Sorry...
    Not like this. I still can see the data on sheet.....
    What I mean is to hide to sheet data...(crucial)..

    Thx.

  8. #8
    VBAX Mentor Justinlabenne's Avatar
    Joined
    Jul 2004
    Location
    Clyde, Ohio
    Posts
    408
    Location
    You would remove the password from the sheet. It is only there so "you" know what it is for the example workbook provided. Just unprotect the sheet (no password) and erase the cell.contents

    You just have to remeber the password, and it is stored within the userform's code module if you want to change it to you own.
    Justin Labenne

  9. #9
    thanks let me check it now
    A mighty flame followeth a tiny sparkle!!



  10. #10
    It gives following error code
    user name u have specified is invalid
    pls give correct username

    & also my right clik is also disabled
    A mighty flame followeth a tiny sparkle!!



  11. #11
    Mac Moderator VBAX Expert shades's Avatar
    Joined
    May 2004
    Location
    Kansas City, USA
    Posts
    638
    Location
    What version are you using. I am using XL 2003 on Win 2K and it works fine for me.

    Software: LibreOffice 3.3 on Mac OS X 10.6.5
    (retired Excel 2003 user, 3.28.2008 )
    Humanware: Older than dirt
    --------------------
    old, slow, and confused
    but at least I'm inconsistent!

    Rich

  12. #12
    Just A Dude VBAX Tutor Scottie P's Avatar
    Joined
    May 2004
    Location
    Remote from 18901 USA
    Posts
    263
    Location
    Quote Originally Posted by sheeeng
    Sorry...
    Not like this. I still can see the data on sheet.....
    What I mean is to hide to sheet data...(crucial)..

    Thx.
    Here Sheeeng, try this.
    Is this what you're looking for?


    **EDIT**

    If anyone downloaded the first version that I posted, dump it and try this one.
    I had to update something in the file (which I had forgotten about previously).
    No danger, just old contact info left in from days gone by is all.

    Scott
    Life is Visual: Presence is Perception...
    How we see the world is how we respond to it. ~* Peace *~

  13. #13
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by Scott
    Here Sheeeng, try this.
    Is this what you're looking for?


    **EDIT**

    If anyone downloaded the first version that I posted, dump it and try this one.
    I had to update something in the file (which I had forgotten about previously).
    No danger, just old contact info left in from days gone by is all.

    Scott
    What is the password? Thx.

    ....

    Ok, I found it...pretty good....i like it.
    Thx.

    BTW, what is a wookie?
    Last edited by sheeeng; 07-06-2005 at 10:29 PM. Reason: Found Password

  14. #14
    Just A Dude VBAX Tutor Scottie P's Avatar
    Joined
    May 2004
    Location
    Remote from 18901 USA
    Posts
    263
    Location
    Star Wars movie character...Big hairy guy. LOL!

    The only thing that is not possible with this password input (as far as I know) is masking the password as it is being entered. To do that, the input would need to be built on a small userform containing a textbox - then the password could be masked to look like ***** instead of 123abc.

    Scott
    Life is Visual: Presence is Perception...
    How we see the world is how we respond to it. ~* Peace *~

  15. #15
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by Scott
    Star Wars movie character...Big hairy guy. LOL!

    Scott
    The wookie...is he...I cannot remember...
    What is he called? besides wookie.

  16. #16
    Just A Dude VBAX Tutor Scottie P's Avatar
    Joined
    May 2004
    Location
    Remote from 18901 USA
    Posts
    263
    Location
    Chewbakka? Something like that...Jake would know the correct name/answer for this one.

    Life is Visual: Presence is Perception...
    How we see the world is how we respond to it. ~* Peace *~

  17. #17
    Quote Originally Posted by Scott
    Here Sheeeng, try this.
    Is this what you're looking for?


    **EDIT**

    If anyone downloaded the first version that I posted, dump it and try this one.
    I had to update something in the file (which I had forgotten about previously).
    No danger, just old contact info left in from days gone by is all.

    Scott
    Its cool

    this is wat i was looking for
    but i have to little customize it?

    thanks

    A mighty flame followeth a tiny sparkle!!



  18. #18
    ok no more issues
    A mighty flame followeth a tiny sparkle!!



  19. #19
    VBAX Newbie
    Joined
    Aug 2004
    Posts
    5
    Location
    Hi Scott

    I like what you have done. .

    You can mask the password by ***** if use api (see attached document). This is not my code, i can remember where I got it, but enjoyed...

  20. #20
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Trying to modify Scott's solution to where on open it shows sheet2 and asks for the password to sheet1 which is the sheet I want protected. Any help would be appreciated. Thanks
    Peace of mind is found in some of the strangest places.

Posting Permissions

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