LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Closing user form in Initialize macro?

Another possibility.

Load the userform. Check if the Combobox has any items (Combobox1.ListCount
0) and then proceed. appropriately.


something like

Load UserForm1
If UserForm1.ComboBox1.ListCount 0 Then
UserForm1.Show
Else
Unload UserForm1
End If

where the UserForm's Initialize event loads the combobox with MS Access
data.

worked for me.


"Don Wiss" wrote in message
...
I have a situation where the user form Initialize routine can fail to
retrieve data from Access (which is used to populate a combo box). I now
display a msgbox, but I then have to display the form, which of course is
non-functional. I tried using Unload Me, but it didn't work. Presumably
as the form wasn't yet loaded. I would think there must be a way to abort
an initialization and not display the form.

Don <www.donwiss.com (e-mail link at home page bottom).





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing Excel user form generates error Ken Warthen Excel Discussion (Misc queries) 0 October 10th 07 08:30 PM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM
Help w/ macro to run user form GMet Excel Programming 2 September 7th 04 07:12 PM
User Form activated by a macro mxleite Excel Programming 3 July 3rd 04 01:33 AM
need form to initialize without closing bruce forster Excel Programming 2 April 21st 04 11:57 PM


All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"