parse a string and do a simple comparison

R

ryguy7272

I am trying to parse a string and do a simple comparison, using VBA.

Here’s my VBA:
(Trim(Mid(imgElement.Title, Search(":", imgElement.Title) + 2, 999)))
<> username

Here is a sample of the imgElement.Title:
EX-0010083GG05436.xls Checked Out To: Goldsmith, Teddy [HYH]


Username comes from Windows_NT signon.

I keep getting an error that reads ‘Sub or function not defined’ and
Search (in my code above) is highlighted. What am I doing wrong?

Thanks!
Ryan--
 
R

ryguy7272

I am trying to parse a string and do a simple comparison, using VBA.
Here’s my VBA:
(Trim(Mid(imgElement.Title, Search(":", imgElement.Title) + 2, 999)))
<> username
Here is a sample of the imgElement.Title:
EX-0010083GG05436.xls Checked Out To: Goldsmith, Teddy [HYH]
Username comes from Windows_NT signon.
I keep getting an error that reads ‘Sub or function not defined’ and
Search (in my code above) is highlighted.  What am I doing wrong?
Thanks!
Ryan--

Search is not a VBA function; it is a worksheet function.

Take a look at Instr for a similar VBA function (or use
worksheetfunction.Search)

Thanks Ron!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top