LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Runtime 91 error due to cells.find statement !??!

Greetings all,

My VB6 w/OLE Automation works fine until it comes to the last line
listed, then burps with a "Runtime Error 91 Object variable or With
block variable not set" message

Dim xlApp As Excel.Application 'early-binding
Dim xlWrkbook As Excel.Workbook
Dim xlWrksheets As Excel.Worksheets
Dim xlWrksheet As Excel.Worksheet
Set xlApp = New Excel.Application
'--- open checklist spreadsheet
Set xlWrkbook = xlApp.Workbooks.Open("C:\mystuff\mysprdsht.xls")
'--- do 4th sheet
Set xlWrksheet = xlApp.Worksheets(5)
xlWrksheet.Activate

Dim cells_found As Range
cells_found = xlWrksheet.Cells.Find(What:="foobar") <-- fails
here

cells_found = xlWrksheet.Cells.Find("foobar") <-- tried thys
syntax, also fails


What am I doing wrong?

TIA,

Steve

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to protect cells in macro sheet b/c runtime error 1004 rldjda Excel Worksheet Functions 1 March 20th 08 08:28 PM
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Copy only Visible cells to another sheet in Macro? Runtime 438 error? nbaj2k[_3_] Excel Programming 3 July 18th 06 04:27 PM
Runtime error 424 object required on Set Statement looloo[_2_] Excel Programming 1 December 1st 05 08:23 PM
Using Find statement in VBA module causes error 91 Gsp Excel Programming 1 October 20th 04 12:47 PM


All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"