Prev: msgbox on top
Next: Trim?
From: Al Dunbar on


"James Robertson" <JamesRobertson(a)discussions.microsoft.com> wrote in
message news:0F32744E-0918-4481-AB30-4A2C29FAF6EC(a)microsoft.com...
> John thanks for the post, but I found in another area of the WWW that Tom
> Lavedas had also posted the following from
> http://www.keyongtech.com/5514325-ignoring-case in which I modified the
> line
>
> If InStr(objAttachment.filename,"Court Register") > 0 Then
>
> With
>
> If InStr(1, objAttachment.filename,"Court Register", 1) > 0 Then
>
> and that solved the problem. John and Tom thank you for providing the
> expertise in solving this old issue.

Not to belittle their expertise, but this was a simple case of reading the
documentation. You knew about the InStr function, but did not know about the
optional arguments. From what source did you get your information about
InStr? Was that source just some sample code, or was it documentation of
some sort? If documentation, then it was poor documentation if incomplete.

VBScript documentation is available:

- in lots of books
- in a downloadable form from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
- and/or online at:
http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspx

/Al

>
> "John J. Jobst" wrote:
>
>> Use the lowercase function on the filename and compare it to a lowercase
>> string.
>>
>> "James Robertson" <JamesRobertson(a)discussions.microsoft.com> wrote in
>> message news:5BF97151-3953-44B5-92C2-0FBEAFB16062(a)microsoft.com...
>> > Here is the script that I am using and it works well except that it
>> > does
>> > not
>> > ignore the case of the attached files. Can any one give me the peice
>> > that
>> > I
>> > need to have it ignore the case of the attached file?
>> >
>> > <SCRIPT LANGUAGE="VBScript">
>> > Sub ExStoreEvents_OnSave(pEventInfo, bstrURLItem, lFlags)
>> > Set msgobj = CreateObject("CDO.Message")
>> > msgobj.DataSource.Open bstrURLItem
>> > For Each objAttachment In msgobj.Attachments
>> > If InStr(objAttachment.filename,"Register Document") > 0 Then
>> > objAttachment.SaveToFile
>> > "\\Server\c$\Inetpub\Intranet\Documents\" & objAttachment.filename
>> > End If
>> > Next
>> > Set msgobj = Nothing
>> > End Sub
>> > </SCRIPT>
>>
>>
>> .
>>
From: "Dave "Crash" Dummy" on
Al Dunbar wrote:
>
>
> "James Robertson" <JamesRobertson(a)discussions.microsoft.com> wrote in
> message news:0F32744E-0918-4481-AB30-4A2C29FAF6EC(a)microsoft.com...
>> John thanks for the post, but I found in another area of the WWW
>> that Tom Lavedas had also posted the following from
>> http://www.keyongtech.com/5514325-ignoring-case in which I modified
>> the line
>>
>> If InStr(objAttachment.filename,"Court Register") > 0 Then
>>
>> With
>>
>> If InStr(1, objAttachment.filename,"Court Register", 1) > 0 Then
>>
>> and that solved the problem. John and Tom thank you for providing
>> the expertise in solving this old issue.
>
> Not to belittle their expertise, but this was a simple case of
> reading the documentation. You knew about the InStr function, but did
> not know about the optional arguments. From what source did you get
> your information about InStr? Was that source just some sample code,
> or was it documentation of some sort? If documentation, then it was
> poor documentation if incomplete.

I have the documentation and I know about the "textual comparison"
option, but it is not clear that it is not case sensitive. "Hello,
World!" is not the same text as "hello,world!" Is "textual comparison"
better defined somewhere?
--
Crash

"The fewer the facts, the stronger the opinion."
~ Arnold H. Glasow ~
From: Al Dunbar on


"Dave "Crash" Dummy" <invalid(a)invalid.invalid> wrote in message
news:LA6kn.4251$3D3.1063(a)newsfe19.iad...
> Al Dunbar wrote:
>>
>>
>> "James Robertson" <JamesRobertson(a)discussions.microsoft.com> wrote in
>> message news:0F32744E-0918-4481-AB30-4A2C29FAF6EC(a)microsoft.com...
>>> John thanks for the post, but I found in another area of the WWW that
>>> Tom Lavedas had also posted the following from
>>> http://www.keyongtech.com/5514325-ignoring-case in which I modified
>>> the line
>>>
>>> If InStr(objAttachment.filename,"Court Register") > 0 Then
>>>
>>> With
>>>
>>> If InStr(1, objAttachment.filename,"Court Register", 1) > 0 Then
>>>
>>> and that solved the problem. John and Tom thank you for providing the
>>> expertise in solving this old issue.
>>
>> Not to belittle their expertise, but this was a simple case of reading
>> the documentation. You knew about the InStr function, but did
>> not know about the optional arguments. From what source did you get your
>> information about InStr? Was that source just some sample code, or was it
>> documentation of some sort? If documentation, then it was poor
>> documentation if incomplete.
>
> I have the documentation and I know about the "textual comparison"
> option, but it is not clear that it is not case sensitive. "Hello,
> World!" is not the same text as "hello,world!" Is "textual comparison"
> better defined somewhere?

I agree the term is less descriptive than it could be. But it is better than
a system I once worked on that used /NCI to make things case sensitive,
where NCI = NON case IN sensitive.

But would an example such as this help explain the term:

Dim MyPos

' This is a binary comparison because the last argument is omitted.
' Returns 3.
MyPos = InStr ("abcdefgh", "c")

' In this binary comparison, the uppercase "C" is not found
' in the lowercase string.
' Returns 0 (not found).
MyPos = InStr ("abcdefgh", "C")

' In this text comparison starting at the first position,
' the uppercase "C" is found in the lowercase string.
' Returns 3.
MyPos = InStr (1, "abcdefgh", "C", vbTextCompare)

If so, you can find this example here, in the msdn documentation I mentioned
earlier:

http://msdn.microsoft.com/en-us/library/wybb344c(VS.85).aspx

/Al



> --
> Crash
>
> "The fewer the facts, the stronger the opinion."
> ~ Arnold H. Glasow ~

First  |  Prev  | 
Pages: 1 2
Prev: msgbox on top
Next: Trim?