View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default Getting "Object Variable or With Block Variable not set" error

I have to admit that I am unfamilliar with "TestPartner", but what you are
trying to do is not going to work. What you need to do is to set "a" to the
current instance of Excel. That being said it is possible to have multiple
instances of Excel running at the same time, so you are going to have
difficulty attaching to the instace that you want. You can create a new
instance of Excel something like this

Dim xlApp As Object

Set xlApp = CreateObject("Excel.Application")

With xlApp
.Visible = True
.Workbooks.Add
.Workbooks.Open "C:\MyBook.xls"
End With
--
HTH...

Jim Thomlinson


"Suraj" wrote:

Thanks Jim and Andrew.
Jim,
I tried in the way you suggested, but the statements inside the For
Loop are not being executed. This time I didn't get any error. Pls let
me know what to do. I am using a tool called "TestPartner" to test the
applications. I am using the VBA in that tool.

Andrew,
I am using VBA but not within ExcelApplication. I am using a tool
called "TestPartner" to test the applications. I am using the VBA in
that tool.

Please suggest me.

Thanks,
Suraj