View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Moving from Excel 2003 to Excel 2000

No expert on RegExp, but according to the link below, this is expected:

<http://www.regular-expressions.info/vbscript.html
The Execute method also takes one string parameter. Instead of returning
True or False, it returns a MatchCollection object. If the regex could not
match the subject string at all, MatchCollection.Count will be zero. If the
RegExp.Global property is False (the default), MatchCollection will contain
only the first match. If RegExp.Global is true, Matches will contain all
matches
</http://www.regular-expressions.info/vbscript.html

NickHK

"Fornol" wrote in message
...
This should clarify it:

Dim objRe As Object
Dim colMatches As Object

Set objRe = CreateObject("VBScript.RegExp")

objRe.Global = False
objRe.pattern = pattern 'pattern to compare with

Set colMatches = objRe.Execute(str) 'str is string to search for

comparison

Execute method is used to extract a matches of a regular expressions from

a
string.

"NickHK" wrote:

You haven't said what kind of object "objColMatches" is.
How did you instantiate it ?
I would guess it is a collection, but.. ?

NickHK

"Fornol" wrote in message
...
Hi,

I am having hard time with a piece of my code.

I created object: objColMatches and in Excel 2003 code I can access

items
in
a following way: objColMatches(1) but Excel 2000 returns error

message:
"Object doesn't support this property or method". When I tried

something
like
this: objColMatches.Item(i) (where i is declared as integer) I

received
message: "Type mismatch". How can I access items in my object in Excel

2000?
Code must be interchangable between both: Excel 2000 and Excel 2003.

Thank you very much for your help.