Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have a strange problem with Excel VBA -code. When I try to enable the textbox in userform called 'Parameters' I sometimes get the run time error '-2147352571'. When I look the debug the Excel tells me that the object variable or with block variable is not set in the following statement Parameters.TextBox1.Enabled = True. The interesting part is that the code works sometimes and sometimes not. For example I have noticed that the code stops to work if I haven't used the Excel in ca. 10 minutes. In addition, it seems that the program doesn't work if I have multiple Excel files simulatiously open. I would appreciate all your comments because I cannot solve this problem. Best regards Vepa |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Showing more code would help.
It may be that a variable is going out of scope under some circumstances. Tim "Vepa" wrote in message ... Hi I have a strange problem with Excel VBA -code. When I try to enable the textbox in userform called 'Parameters' I sometimes get the run time error '-2147352571'. When I look the debug the Excel tells me that the object variable or with block variable is not set in the following statement Parameters.TextBox1.Enabled = True. The interesting part is that the code works sometimes and sometimes not. For example I have noticed that the code stops to work if I haven't used the Excel in ca. 10 minutes. In addition, it seems that the program doesn't work if I have multiple Excel files simulatiously open. I would appreciate all your comments because I cannot solve this problem. Best regards Vepa |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
The problem is that the code doesn't need to be any more complex than this: private sub Commandbutton1_click parameters.show Call testing_init End sub where testing_init, initializes the textbox1 in userform called parameters. In this case: Private Sub UserForm_initialize() parameters.TextBox1.Value = Sheets("Parameters").Cells(5, 4) End sub You mentioned that it might be so that the variables go out of scope sometimes and I would like to know how to avoid this to happen. Best regards Veli-Matti "Tim Williams" wrote: Showing more code would help. It may be that a variable is going out of scope under some circumstances. Tim "Vepa" wrote in message ... Hi I have a strange problem with Excel VBA -code. When I try to enable the textbox in userform called 'Parameters' I sometimes get the run time error '-2147352571'. When I look the debug the Excel tells me that the object variable or with block variable is not set in the following statement Parameters.TextBox1.Enabled = True. The interesting part is that the code works sometimes and sometimes not. For example I have noticed that the code stops to work if I haven't used the Excel in ca. 10 minutes. In addition, it seems that the program doesn't work if I have multiple Excel files simulatiously open. I would appreciate all your comments because I cannot solve this problem. Best regards Vepa |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have you tried initializing the form before showing it ?
Tim "Vepa" wrote in message ... Hi, The problem is that the code doesn't need to be any more complex than this: private sub Commandbutton1_click parameters.show Call testing_init End sub where testing_init, initializes the textbox1 in userform called parameters. In this case: Private Sub UserForm_initialize() parameters.TextBox1.Value = Sheets("Parameters").Cells(5, 4) End sub You mentioned that it might be so that the variables go out of scope sometimes and I would like to know how to avoid this to happen. Best regards Veli-Matti "Tim Williams" wrote: Showing more code would help. It may be that a variable is going out of scope under some circumstances. Tim "Vepa" wrote in message ... Hi I have a strange problem with Excel VBA -code. When I try to enable the textbox in userform called 'Parameters' I sometimes get the run time error '-2147352571'. When I look the debug the Excel tells me that the object variable or with block variable is not set in the following statement Parameters.TextBox1.Enabled = True. The interesting part is that the code works sometimes and sometimes not. For example I have noticed that the code stops to work if I haven't used the Excel in ca. 10 minutes. In addition, it seems that the program doesn't work if I have multiple Excel files simulatiously open. I would appreciate all your comments because I cannot solve this problem. Best regards Vepa |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Error handling error # 1004 Run-time error | Excel Programming | |||
Run-Time Error -2147352571 | Excel Programming | |||
run-time error'-2147352571(8002005) | Excel Programming | |||
Run time Error -2147352571 when showing a form | Excel Programming |