ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loading a form (https://www.excelbanter.com/excel-programming/340138-loading-form.html)

stabilo

loading a form
 
I have created a form that have a treevie control. This treeviw control is
populated with information coming from a recordset.
In the code view of the form I have a sub (Private Sub
userform_initialize()) that call a couple of subs (a sub that populate the
treeview).
My problem is that I would like to have the form diplayed on the screen
while the sub populate the treevview. The problem is that only when the sub
userform_iunitialize is finished the Form appaers.
I have in the module a sub (sub form_load()) that have the following line
userform1.show. When I call this sub from userform_initialize, the form is
displayed but the program stops (like it is in Pause)

Any hint woiuld be welcome. In fact I want to display the form while is
populating because I have a progressbar that I want to show while my program
is parsing my database (using the PercentPosiion property of my recordset)

Bob Phillips[_6_]

loading a form
 
You could fire the loading code from within another macro triggered by
OnTime within the userform initialize. Something like

Private Sub UserForm_Initialize()
Application.OnTime Now + TimeSerial(0, 0, 1), "loadForm"
End Sub

The loadForm macro should be in a standard code module, and should run the
loading subs of yours.

--
HTH

Bob Phillips

"stabilo" wrote in message
...
I have created a form that have a treevie control. This treeviw control is
populated with information coming from a recordset.
In the code view of the form I have a sub (Private Sub
userform_initialize()) that call a couple of subs (a sub that populate the
treeview).
My problem is that I would like to have the form diplayed on the screen
while the sub populate the treevview. The problem is that only when the

sub
userform_iunitialize is finished the Form appaers.
I have in the module a sub (sub form_load()) that have the following line
userform1.show. When I call this sub from userform_initialize, the form

is
displayed but the program stops (like it is in Pause)

Any hint woiuld be welcome. In fact I want to display the form while is
populating because I have a progressbar that I want to show while my

program
is parsing my database (using the PercentPosiion property of my recordset)





All times are GMT +1. The time now is 11:59 PM.

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