Hello everyone! I am a geotechnical engineer and have been tasked with editing hundreds of excel files all in the same way so I decided to go back to my college intro to C days and make VBA do all of my dirty work!
Anyhow, *I* think I am having problems with my library. Someone else who was apparently a programming wiz had the incarnation of this computer before me, and I have a feeling that she MAY have done something with the library......
So to my problem!
The error I am getting is
"Run-time error '91': Object variable or With Block variable not set"
Here is a simple example of what gives me the error (not my code, but just an example :
Sub ThisIsMyError() Dim mychart As Object For Each mychart In Worksheets(1).ChartObjects mychart.Delete Next mychart End Sub
When I looked at my object library, I was able to browse the <globals> and saw that "chartobjects" was not there. Strangely enough "charts" was there..... go figure?
Now, a line like
Works just fine! However not being able to assign certain common objects to variables in excel severely limits me and requires that I bash my head against the wall till I find a work around, heh. I also have the same problem with assigning certain other objects as variables.
Oh, and I am using Excel 2003 SP3/VBA 6.5, if it makes a difference.