Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I didn't think you were using the Load statement. This, as
you're aware, loads but does not show the UF and lets you manipulate it in the Initialize event. My assumption is that the Show statement both loads and shows a UF. Therefore, the Show statement creates a redundacy (since you have already loaded it) which causes the error. In the Auto_Open code, you can simply state UserForm1.Show and forget the Load statement. Also, remove the Show statement in the Initialize code. This works. Regards, Greg -----Original Message----- I did as you suggested, now my UserForm will not display. I have an auto_open macro which is suppose to open the UserForm when the workbook opens (Load UserForm1) "Greg Wilson" wrote in message ... Simply remove the Show statement. You must already be using the Show statement in a separate module to call the UF. When it initializes, your code tells it to show itself again even though it is already called. This causes the error; however, you must close the UF before the error message can display because the UF has priority. Regards, Greg -----Original Message----- The code below does what I need it to do (displays the current date in a textbox when userform1 opens) but when I close the Userform I get the following error: Run-time error '91': object variable or with block variable not set Private Sub UserForm_Initialize() With UserForm1 .DateTextBox.Text = Format(Date, "dddd dd-mmm- yy") .Show End With End Sub . . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your help. I thought I had to load the userform.
"Greg Wilson" wrote in message ... I didn't think you were using the Load statement. This, as you're aware, loads but does not show the UF and lets you manipulate it in the Initialize event. My assumption is that the Show statement both loads and shows a UF. Therefore, the Show statement creates a redundacy (since you have already loaded it) which causes the error. In the Auto_Open code, you can simply state UserForm1.Show and forget the Load statement. Also, remove the Show statement in the Initialize code. This works. Regards, Greg -----Original Message----- I did as you suggested, now my UserForm will not display. I have an auto_open macro which is suppose to open the UserForm when the workbook opens (Load UserForm1) "Greg Wilson" wrote in message ... Simply remove the Show statement. You must already be using the Show statement in a separate module to call the UF. When it initializes, your code tells it to show itself again even though it is already called. This causes the error; however, you must close the UF before the error message can display because the UF has priority. Regards, Greg -----Original Message----- The code below does what I need it to do (displays the current date in a textbox when userform1 opens) but when I close the Userform I get the following error: Run-time error '91': object variable or with block variable not set Private Sub UserForm_Initialize() With UserForm1 .DateTextBox.Text = Format(Date, "dddd dd-mmm- yy") .Show End With End Sub . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming | |||
Run-time error '11' & Run-time error '1004' | Excel Programming | |||
Run-time error '11' & Run-time error '1004' | Excel Programming |