View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ndalal ndalal is offline
external usenet poster
 
Posts: 17
Default method Worksheets of object _Global failed

Hi,

I'm seeing this run-time error in VB when I use the following code:

Dim ws As Worksheet
For Each ws In Worksheets ' this line throws the run-time
error
:


I tried using these statements at the beginning of the function
ActiveCell.Activate and/or DoEvents or putting a delay, but that didn't
help.
I also tried using Excel.Application.Worksheets and other ways to use
worksheets,
but nothing works!

The above code is in a VB DLL, which is compiled and installed
correctly.

This problem happens only when I try to debug my application using
visual studio C++.
The problem does not happen if I run the application stand-alone or
debug it with VB.

Any help is appreciated.

Thanks,
- ND