Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default InStr GRRRRRRRR!!!!!!!!


Hi I'm using XP Pro

Why-oh-why will this bit of code not bloomin well work!

If InStr(0, inputline3, fred, vbTextCompare) 0 Then
etc etc etc
end if

0 is my start position
inputline3 is dimmed as a string,
sample data: <html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns="http://www.w3.org/TR/REC-html40"
....all as one line

fred (every program needs one) is also dimmed as string.
sample data <!--Title--

It sits within a procedure that crawls through a 1 dimensional string
array line by line looking for a trigger within a line of data.

the array contains html as seen which is read in as text. the html
contains all sorts of characters such as quotes, colons '<'s and '''s
!'s and --, probably all illegal characters for excel. I'm searching
for a particular string within a line of html so that I can go off and
do stuff.

I'm sure I got the instr syntax right, but i keep getting a run time
error 5, invalid procedure call or arguament

Could somebody please put me out of my mysery.
I hate when simple stuff like this trips me up

Thanks Andy Clarke


--
andy_brit
------------------------------------------------------------------------
andy_brit's Profile: http://www.excelforum.com/member.php...o&userid=28002
View this thread: http://www.excelforum.com/showthread...hreadid=475054

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default InStr GRRRRRRRR!!!!!!!!




Who forgot about 'option base 1' at the top of the module and who was
using 0 as the start position for the array comparison.

Somedays, my stupidity astounds even me!

The general help thing is that if you are using an index in a function
is to ensure that the appropriate option statement is used at the top
of the module. My InStr was wayyyyy down the code, completely forgot
about Option...

Thanks for looking anyway

Andy


--
andy_brit
------------------------------------------------------------------------
andy_brit's Profile: http://www.excelforum.com/member.php...o&userid=28002
View this thread: http://www.excelforum.com/showthread...hreadid=475054

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default InStr GRRRRRRRR!!!!!!!!

Option Base has no effect on the index number used to refer to the first
element of a string - a string is not an array of characters like in C/C++

the first element of a string is always 1.

so yes, your command should be

If InStr(1, inputline3, fred, vbTextCompare) 0 Then

regardless of your Option Base setting.

--
Regards,
Tom Ogilvy

"andy_brit" wrote
in message ...



Who forgot about 'option base 1' at the top of the module and who was
using 0 as the start position for the array comparison.

Somedays, my stupidity astounds even me!

The general help thing is that if you are using an index in a function
is to ensure that the appropriate option statement is used at the top
of the module. My InStr was wayyyyy down the code, completely forgot
about Option...

Thanks for looking anyway

Andy


--
andy_brit
------------------------------------------------------------------------
andy_brit's Profile:

http://www.excelforum.com/member.php...o&userid=28002
View this thread: http://www.excelforum.com/showthread...hreadid=475054



Reply
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
Help with VBA InStr() function EagleOne Excel Discussion (Misc queries) 10 April 12th 07 02:47 PM
InStr Harley Excel Programming 3 August 9th 05 08:55 PM
InStr FGM Excel Programming 3 July 14th 05 08:47 PM
InStr and ADO Al Excel Programming 2 June 17th 04 04:22 PM


All times are GMT +1. The time now is 11: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"