View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Using Cells while UserForm shown

If you want the code to wait for the form to drop, then divide the code into
two parts.

end the first by showing the form. Start the second from the form.

If the code is running, generally it wouldn't be appropriate for the user to
be accessing the worksheet, so it isn't clear what you are trying to
accomplish,.

--
Regards,
Tom Ogilvy

"T_o_n_y" wrote in message
...
I'm looping because I don't really understand how a modeless form with
controls works. I'm used to having the code exit after the user form is
dismissed.
When I don't loop the program shows the form but then "continues on"
executing code, which means that it proceeds to exit the program. I don't
understand what I should put after

user.show

that will enable the program to still respond to the userform and yet not
exit.

Thanks,
Tony
"Tom Ogilvy" wrote:

Why are you looping?


Use the click event of the goAwayClick box to run code to terminate
things.
(although I don't know why you wouldn't use a commandbutton for this).

--
Regards,
Tom Ogilvy






"T_o_n_y" wrote in message
...
Tom,

I have tried vbModeless, but not sucessfully for this. I'm not sure
how I
would modify my code to make this work, and simply adding vbModeless
resulting in the form being shown and then the program exiting.

My original code showing the form was like this.
Set user = New fLayout
response = vbNo
While response = vbNo
user.show
'exit program entirely when user clicks go away box
If user.goAwayClick Then
response = MsgBox("Are you sure you want to exit the program
now?", vbYesNo)
Else
response = vbYes
End If
Wend
Unload user
Exit Sub

I also tried this, but it sent the program into a cpu loop.
Do
user.show vbModeless
Loop Until user.goAwayClick
Unload user

I have used vbModeless for userforms to display brief messages, but not
with
controls on them. Could you provide some more help?

Thanks,
Tony

"Tom Ogilvy" wrote:

Userform1.show vbModeless

allows you to do what you describe. (xl2000 and later)

--
Regards,
Tom Ogilvy


"T_o_n_y" wrote in message
...
I have an Excel VBA routine that controls another application
(AutoCAD)
via
Excel userforms. While userforms are shown, you cannot use Excel
ells --
it's frozen. I like the fact that the user has full access to
AutoCAD
while
my Excel VBA routine is controlling it, but I'd also like them to
have
access
to Excel worksheets.

Please tell me if I'm right. I'm guessing that:
1) This cannot be done
2) I could do it if I was controlling both Excel & AutoCAD using vb
(which
I
don't have)
3) I could do it if I was controlling both Excel & AutoCAD using a
3rd
VBA
application such as Word (which I do have).
4) I might be able to do it if I put controls on a worksheet rather
than
on
a userform?

Thanks,
-Tony