Running Line of code twice causes activeX error 0x8000ffff

164 views Asked by At

Following code causes an ActiveX error 0x8000ffff if executed twice.

It all boils down to this two lines, as the rest of the code runs smoothly. In particular, if I run the line of code only once, it works great. If I run the line of code twice I get the error. Note that the line is only reading the variable, so I do not understand why it would not be readable the second time. If s_Var changes, then it works, essentially i can read every column once.

This works:

         obj_Dlr = GetDataLoggerRecipe(s_Dlr)
         If Not s_Var = "" Then

            Debug.Print obj_Dlr.GetColumn(s_Var).Name

         End If

This not:

         obj_Dlr = GetDataLoggerRecipe(s_Dlr)
         If Not s_Var = "" Then

            Debug.Print obj_Dlr.GetColumn(s_Var).Name
            Debug.Print obj_Dlr.GetColumn(s_Var).Name

         End If

Also reassigning the variable does not work..

         obj_Dlr = GetDataLoggerRecipe(s_Dlr)
         If Not s_Var = "" Then

            Debug.Print obj_Dlr.GetColumn(s_Var).Name

         End If

         obj_Dlr = GetDataLoggerRecipe(s_Dlr)
         If Not s_Var = "" Then

            Debug.Print obj_Dlr.GetColumn(s_Var).Name

         End If

I'm interested in understanding what is going on, as it helps me to solve anotehr problem.

Thanks

0

There are 0 answers