View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Run-time error '-2147352571'

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