Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: If InStr("MONTH", f) Then NOT WORKING

    the string im searching for is :
    its a file name, but my instr isnt picking it up !

    Is there any way to use filtering or find like in ado? Is there a Like statement i can use in Xl?

    if f like "%month" ??

    Private Function GetFiles(direc As String, ii As Integer) As Variant
    Dim f As String
    Dim i As Integer
    Dim Items() As String
    ReDim Items(ii)
    i = 0
    f = Dir(direc & "*.xl?", vbNormal)
    Do While f <> ""
    ' If InStr("MONTH", f) Then
    Items(i) = f
    i = i + 1
    ' End If
    f = Dir
    GetFiles = Items()
    End Function

  2. #2
    Join Date
    Oct 2003

    If InStr(f, "MONTH") > 0 Then Will work :)

    Reverse the order of the parameters to InStr !

    Also it returns not a boolean but an integer (position)
    hence it should be :

    If InStr(f, "MONTH") > 0 Then

    This will work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts