Thread: Pausing Code
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Pausing Code

Nigel,

A user form can be displayed modally or modelessly. When it is displayed
modally, with code like

UserForm1.Show vbModal

the code pauses on the Show method and only code within the form can
execute. You cannot access the worksheet or command bars while the form is
visible. When the form is hidden or unloaded, code resume execution on the
line following the Show method.

When a form is displayed modelessly, with code like

UserForm1.Show vbModeless

the Show method causes the form to be displayed but execution carries on
after the Show even while the form is visible. If you don't specifiy vbModal
or vbModeless, the default mode is based on the ShowModal property of the
form.

I would explicitly use vbModal to ensure that the form is being displayed
modally.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Nigel" wrote in message
...
Hi All
I currently have an application code that uses a series of MsgBox to ask
user to accept or not specific actions. Such as "Data for Dec07 is
already loaded, overwrite?", a Yes / No option then determines the next
step.
This works ok.

I have now decided to incorporate a UserForm, with labels acting as
messages and command buttons to decide actions. Unlike the MsgBox which
halts the code this method does not pause. Rather than have to
re-engineer the entire code, I was looking for suggestions as to how to
proceed.


--

Regards,
Nigel