View Full Version : password a macro or command button


go2review.com
04-20-2009, 03:26 AM
I have used a macro to download information into an excel spread sheet and this works fine.using a command button it downloads fine but the file is very sensitive and i want the macro or button to be password protected is this possible

gemma-the-husky
04-20-2009, 09:08 AM
the simplest way is to say

if inputbox("Enter Password to continue")<>"correctpassword" then
msgbox ("sorry - wrong password")
exit sub
end if


the only trouble is that with an input box, the entry cant be "passworded" ie masked with **** symbols. if you need this, you have to design your own form to do this, and it becomes trickier

go2review.com
04-20-2009, 11:25 PM
sorry to sound thick as im not that well adversed to this, where do i put this formula ?

gemma-the-husky
04-21-2009, 02:27 AM
not sure with a macro

but just put it at the start of the click event code for a button

ajetrumpet
04-21-2009, 02:36 AM
I have used a macro to download information into an excel spread sheet and this works fine.using a command button it downloads fine the way i read this quote is two fold:

1) I use macro commands to download to Excel
2) The macro is INITIATED by a command button.

if #2 is true, you're going to have to convert you're macro into code with the code converter from the interface (there is a button for this on the toolbar). because i don't think you can just NAME a macro with a CLICK() event AND pour code on top of that is well. Gemma' code has to go before any macro action. isnt that right dave?

go2review.com
04-21-2009, 02:51 AM
im lost can i send the data base to you

ajetrumpet
04-21-2009, 05:19 AM
im lost can i send the data base to youif you're speaking to me, perhaps the best thing to do would be to post it up here at the forum? see here for instructions on how to do this: http://www.access-programmers.co.uk/forums/showthread.php?t=140587&highlight=upload

go2review.com
04-21-2009, 05:27 AM
the button on the opening page is the one i want to password protect

ajetrumpet
04-30-2009, 12:45 PM
the button on the opening page is the one i want to password protectthis is how you do it Review...

the code is only 5 lines...

go2review.com
05-01-2009, 02:19 AM
superb thank you very much it works a dream, get well soon

ajetrumpet
05-01-2009, 07:01 AM
superb thank you very much it works a dream, get well soonno prob. have fun with it. =)