ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password Setting (https://www.excelbanter.com/excel-programming/336638-password-setting.html)

VBALearner

Password Setting
 

hi hi, it is so nice to have this forum...

I have a query on VBA programming regarding password setting. How to
set up a password when opening a file. good to have expiry date!! I
tried once before to write a macro to lock the file. However, if the
user choose "disable macros", then it does not work! Is there any way
out?? I know there is a built-in funtion in Excel to protect a file
from reading or writing upon opening. But there is no expiry date
attached!! thank you for yr help!!! :)


--
VBALearner
------------------------------------------------------------------------
VBALearner's Profile: http://www.excelforum.com/member.php...o&userid=26019
View this thread: http://www.excelforum.com/showthread...hreadid=393734


Vasant Nanavati

Password Setting
 
"VBALearner" wrote
in message ...
However, if the
user choose "disable macros", then it does not work! Is there any way
out??


Not really.

--

Vasant




Piranha[_30_]

Password Setting
 

VBALearner,
You could force the user to enable macros, by having the workbook auto
close
if the macros are not enabled..

Here is one way.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=578

Dave
VBALearner Wrote:
hi hi, it is so nice to have this forum...

I have a query on VBA programming regarding password setting. How to
set up a password when opening a file. good to have expiry date!! I
tried once before to write a macro to lock the file. However, if the
user choose "disable macros", then it does not work! Is there any way
out?? I know there is a built-in funtion in Excel to protect a file
from reading or writing upon opening. But there is no expiry date
attached!! thank you for yr help!!! :)



--
Piranha
------------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435
View this thread: http://www.excelforum.com/showthread...hreadid=393734


Gareth[_6_]

Password Setting
 
Just expand on this, you can't have the workbook auto close since this
would require the running of macros. What you can do is have the
workbook default to a blank sheet upon opening (maybe with a message
advising to reopen with macros enabled) and all the other sheets hidden.

I checked our the below link. In addition to the code it proposes, I
would use BeforeSave to hide all the sheets upon saving. Otherwise, if
the user saves but doesn't close the workbook it will not be saved in
the "locked up" state should they crash out of Excel.

With respect to your other query about password dates: no such
functionality exists to my knowledge. There are ways and means around
such a thing though. For example, you could include a check for the
system date in the BeforeSave event of a workbook and remove / add a
password depending on the date.

My preferred option, rather than use event trapping, is to
programmatically open the workbook - maybe from a option form or menu
button loaded by a separate AddIn - often using the user's network login
to determine their rights. This way you are more in control and it's
often simpler for the user too - but it doesn't lend itself to all
circumstances.

HTH,
Gareth

Piranha wrote:
VBALearner,
You could force the user to enable macros, by having the workbook auto
close
if the macros are not enabled..

Here is one way.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=578

Dave
VBALearner Wrote:

hi hi, it is so nice to have this forum...

I have a query on VBA programming regarding password setting. How to
set up a password when opening a file. good to have expiry date!! I
tried once before to write a macro to lock the file. However, if the
user choose "disable macros", then it does not work! Is there any way
out?? I know there is a built-in funtion in Excel to protect a file
from reading or writing upon opening. But there is no expiry date
attached!! thank you for yr help!!! :)





Piranha[_31_]

Password Setting
 

Gareth,
Yeah i didn't express my self very well did i. (You could force th
user to enable macros,
by having the workbook auto close if the macros are not enabled..)
Pretty much common sense huh.

What i was thinking and what i wrote weren't coordinated

I have a few workbooks set up like you describe, they work well.

Thanks for correcting my post, don't want to give bad info.

Dave
Gareth Wrote:
Just expand on this, you can't have the workbook auto close since this
would require the running of macros. What you can do is have the
workbook default to a blank sheet upon opening (maybe with a message
advising to reopen with macros enabled) and all the other sheet
hidden.

I checked our the below link. In addition to the code it proposes, I
would use BeforeSave to hide all the sheets upon saving. Otherwise, if
the user saves but doesn't close the workbook it will not be saved in
the "locked up" state should they crash out of Excel.

With respect to your other query about password dates: no such
functionality exists to my knowledge. There are ways and means around
such a thing though. For example, you could include a check for the
system date in the BeforeSave event of a workbook and remove / add a
password depending on the date.

My preferred option, rather than use event trapping, is to
programmatically open the workbook - maybe from a option form or menu
button loaded by a separate AddIn - often using the user's networ
login
to determine their rights. This way you are more in control and it's
often simpler for the user too - but it doesn't lend itself to all
circumstances.

HTH,
Gareth

Piranha wrote:
VBALearner,
You could force the user to enable macros, by having the workboo

auto
close
if the macros are not enabled..

Here is one way.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=578

Dave
VBALearner Wrote:

hi hi, it is so nice to have this forum...

I have a query on VBA programming regarding password setting. Ho

to
set up a password when opening a file. good to have expiry date!!

I
tried once before to write a macro to lock the file. However, if the
user choose "disable macros", then it does not work! Is there an

way
out?? I know there is a built-in funtion in Excel to protect a file
from reading or writing upon opening. But there is no expiry date
attached!! thank you for yr help!!! :)





--
Piranh
-----------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...fo&userid=2043
View this thread: http://www.excelforum.com/showthread.php?threadid=39373


VBALearner[_2_]

Password Setting
 

Dear Dave,Gareth,Piranha & Vasant

Thank you so much for yr advice or info. It helps me a lot....


--
VBALearner
------------------------------------------------------------------------
VBALearner's Profile: http://www.excelforum.com/member.php...o&userid=26019
View this thread: http://www.excelforum.com/showthread...hreadid=393734


Gareth[_6_]

Password Setting
 
I couldn't agree more - getting down what's in your head just doesn't
happen sometimes - even when you read it back to yourself it looks
ok.... until you've posted it that is... *then* you realise!

;-)

Piranha wrote:
Gareth,
Yeah i didn't express my self very well did i. (You could force the
user to enable macros,
by having the workbook auto close if the macros are not enabled..)
Pretty much common sense huh.

What i was thinking and what i wrote weren't coordinated

I have a few workbooks set up like you describe, they work well.

Thanks for correcting my post, don't want to give bad info.

Dave
Gareth Wrote:

Just expand on this, you can't have the workbook auto close since this
would require the running of macros. What you can do is have the
workbook default to a blank sheet upon opening (maybe with a message
advising to reopen with macros enabled) and all the other sheets
hidden.

I checked our the below link. In addition to the code it proposes, I
would use BeforeSave to hide all the sheets upon saving. Otherwise, if
the user saves but doesn't close the workbook it will not be saved in
the "locked up" state should they crash out of Excel.

With respect to your other query about password dates: no such
functionality exists to my knowledge. There are ways and means around
such a thing though. For example, you could include a check for the
system date in the BeforeSave event of a workbook and remove / add a
password depending on the date.

My preferred option, rather than use event trapping, is to
programmatically open the workbook - maybe from a option form or menu
button loaded by a separate AddIn - often using the user's network
login
to determine their rights. This way you are more in control and it's
often simpler for the user too - but it doesn't lend itself to all
circumstances.

HTH,
Gareth

Piranha wrote:

VBALearner,
You could force the user to enable macros, by having the workbook


auto

close
if the macros are not enabled..

Here is one way.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=578

Dave
VBALearner Wrote:


hi hi, it is so nice to have this forum...

I have a query on VBA programming regarding password setting. How


to

set up a password when opening a file. good to have expiry date!!


I

tried once before to write a macro to lock the file. However, if the
user choose "disable macros", then it does not work! Is there any


way

out?? I know there is a built-in funtion in Excel to protect a file

from reading or writing upon opening. But there is no expiry date

attached!! thank you for yr help!!! :)







All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com