ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable UserForm Objects (https://www.excelbanter.com/excel-programming/377256-disable-userform-objects.html)

Sean Connery via OfficeKB.com

Disable UserForm Objects
 
I have been making use of UserForms to enter information into an Excel
spreadsheet. Sometimes, when raising the forms it is necessary to enter
information into some of the objects on the UserForms. Unfortunately, this
activates some of the macros relevant to these objects, which I would
initially prefer not to do. Is it possible to disable the macros on
UserForms, in much the same way as event procedures can be disabled in
Worksheet objects?

If anyone can help, please respond. Thank you.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1


Bob Phillips

Disable UserForm Objects
 
Thi is a technique I use to stop re-entry into an event


Private fEnabled As Boolean

Private Sub TextBox1_Change()
If fEnabled Then
fEnabled = False
'do your stuff
fEnabled = True
End If
End Sub

Private Sub UserForm_Initialize()
fEnabled = True
End Sub

You can use it by adding to those controls tou want tro disabole, and set
fEnabled to false.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Sean Connery via OfficeKB.com" <u5428@uwe wrote in message
news:6922ec02ab2f6@uwe...
I have been making use of UserForms to enter information into an Excel
spreadsheet. Sometimes, when raising the forms it is necessary to enter
information into some of the objects on the UserForms. Unfortunately,

this
activates some of the macros relevant to these objects, which I would
initially prefer not to do. Is it possible to disable the macros on
UserForms, in much the same way as event procedures can be disabled in
Worksheet objects?

If anyone can help, please respond. Thank you.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200611/1





All times are GMT +1. The time now is 04:21 PM.

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