Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile Error?
Please help! I compiled my VBA project and I got the following message. "Compile Error Variable Not Defined". When I clicked on debug it took me to the following code and highlighted the line frmMyUserform.Show vbModeless. Can someone please help me understand why. Although my form is working fine. Is this something I need to fix? If so how? Thank you for any help. Private Sub UserForm2_Initialize() Load UserForm2 UserForm2.Show frmMyUserform.Show vbModeless Me.FormDate = Format(Date, "mm-dd-yyyy") End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile Error?
Should be
UserForm2.Show vbModeless delete the line frmMyUserform.Show vbModeless -- Regards, OssieMac |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile Error?
I'm guessing that this code is behind the userform.
If that's true, then you can't rename the procedure names--use: Private Sub UserForm_Initialize() And you don't need these two lines: Load UserForm2 UserForm2.Show And I'm still guessing that frmMyUserForm is a different userform--if that's true, do you really want to show that when userform2 is shown? If it's the same as the userform that's being loaded (and I guessed wrong), then remove that line, too. TotallyConfused wrote: Please help! I compiled my VBA project and I got the following message. "Compile Error Variable Not Defined". When I clicked on debug it took me to the following code and highlighted the line frmMyUserform.Show vbModeless. Can someone please help me understand why. Although my form is working fine. Is this something I need to fix? If so how? Thank you for any help. Private Sub UserForm2_Initialize() Load UserForm2 UserForm2.Show frmMyUserform.Show vbModeless Me.FormDate = Format(Date, "mm-dd-yyyy") End Sub -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compile Error?
I am guilty of not reading and understanding the question well enough. For
that matter I am still not sure I fully understand it now. maybe Dave has answered your question. However, the following information might also help. If you have 2 forms open and you want to be able to work on both then they should both be modeless. If you show a modal form then all following code stops in the sub that shows the form until you close the form and then the remaining code in the sub executes. Therefore if you open a modal form and in the same sub you try to show another form after it then the second form will not show until the first one is closed. If you open a modeless form then the remaining code in the sub continues to execute. If the code shows a modal form after the modeless form then both forms will show but you are stuck on the modal form and cannot focus on the modeless form until the modal form is closed. -- Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Bubble sort Error (Compile Error: Type Mismtach) | Excel Programming | |||
VBAProject name compile error, not defined at compile time | Excel Programming | |||
error message: compile error, argument not optional | Excel Programming | |||
How do I get rid of "Compile error in hidden module" error message | Excel Discussion (Misc queries) |