Eneable or unEneable Events in the Forms created with VBA for MS-Word

M

MorenD

I use to include the sentence "Application.EneableEvent = 'False' or
'True'" in VBA applications developed in the MS-Excel platform. It works
very well in association with actions performed in the spreadsheets or the
workbook, but not when the action is performed in Userforms.
Now I am develop a short utility in VBA using the MS-Word platform and
I need to know if it is posible to un-eneable the events associated to
elements of a Userform created with VBA in MS-Word?
 
D

Doug Robbins - Word MVP

You can certainly enable or disable controls on a userform using the
..Enabled attribute of the control

[controlname].Enabled = False

will disable the control named controlname. Setting the attribute to True
will enable the control.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Shauna Kelly

Hi MorenD

Word (sadly) has no equivalent of Excel's Application.EnableEvents method.
And no VBA has an .EnableEvents that works in user forms.

The workaround is generally to create a global or module-wide variable
called, say, bEventsEnabled as a boolean. Wrap your code like this:

If bEventsEnabled then
'your code here
Endif

and set bEventsEnabled to False when you don't want the event code to run.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
J

Jezebel

Another approach is put the from controls inside a frame: then you can
enable/disable them collectively by enabling/disabling the frame.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top