ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   method Worksheets of object _Global failed (https://www.excelbanter.com/excel-programming/360317-method-worksheets-object-_global-failed.html)

ndalal

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


ndalal

method Worksheets of object _Global failed
 
Can someone please help with this problem?

More info is that when I put "Application" in VB watch window, I see
various objects like:
Worksheets : <Application-defined or object-defined error

This happens ONLY when I debug my application using visual studio 6
C++. If I dont use C++ as debugging tool, then "Application" looks
fine...I'm really stucked !!

Thanks in advance.



All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com