Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel Find causes syntax error at runtime
#1
Not Solved
Hoping somebody can help out here. I've opened an excel file in a qtp test and want to execute a find method on a range of cells. I can call find with just one paramater, the search string like this:

myRange.Find("some text")

and it returns the result fine. Problem is that if "some text" is in the spreadsheet as :

some text plus more text
and
some text

Then this method will return the first occurence on the basis that its a partial match. I want to return exact matches only.

So, looking at the signature of the Find method as supplied in a drop down list in QTP when I start typing Find( it looks like it accepts a param LookAt:=xlWhole. In fact if I generate a macro in excel it does indeed give me the following :

Set r = appexcel.Range("B9:B2385").Find("some text",,,lookAt:=xlWhole,,,,,)

So, when I try calling this in QTP it gives a syntax error both in QTP and at runtime. I've tried all manner of combinations here but the Find method will not accept more that a simple string. Any help much appreciated.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  General Object Error(Find Object Error) akhandesh 1 3,620 02-24-2016, 01:05 PM
Last Post: sindhus
  System Utility Syntax chita26 1 4,933 11-04-2014, 12:41 PM
Last Post: vinod123
  Getting 'Unknown runtime error' UFT_Newbie 3 5,631 09-08-2014, 07:07 PM
Last Post: UFT_Newbie
Smile find out of spelling error in Web application deveshbhatt29 1 2,219 01-10-2014, 05:10 PM
Last Post: Maheep_bhambri
  how to find Excel file exist or not in vbscript code sree.85 3 11,262 08-22-2013, 11:42 AM
Last Post: akhandesh

Forum Jump:


Users browsing this thread: 1 Guest(s)