ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Click event to run only once (https://www.excelbanter.com/excel-programming/312915-click-event-run-only-once.html)

gavmer[_92_]

Click event to run only once
 

HI there,

small problem........i was hoping that once the code ran...that was it.
Prob is, when the file is saved, closed and then open again, the code
can run once more. I will run only once when clicked on un-saved file
but i want to prevent a user from running the code more than once
permanently. Can someone help???

Cheers!!!


--
gavmer
------------------------------------------------------------------------
gavmer's Profile: http://www.excelforum.com/member.php...fo&userid=6662
View this thread: http://www.excelforum.com/showthread...hreadid=264970


mark

Click event to run only once
 
Gidday,

In a general module


dim mintNumNuts as integer
sub Auto-Open()
mintNumNuts=0
end sub




In the routine to save,

before save option

if mintNumNuts<0 then
msgbox "This workbook can not be saved",vbcritical
activeworkbook.close false
exit sub
end if

mintNumNuts=1




regards
mark









-Mark
-----Original Message-----

HI there,

small problem........i was hoping that once the code

ran...that was it.
Prob is, when the file is saved, closed and then open

again, the code
can run once more. I will run only once when clicked on

un-saved file
but i want to prevent a user from running the code more

than once
permanently. Can someone help???

Cheers!!!


--
gavmer
----------------------------------------------------------

--------------
gavmer's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=6662
View this thread:

http://www.excelforum.com/showthread...hreadid=264970

.



All times are GMT +1. The time now is 10:17 AM.

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