Results 1 to 7 of 7

Thread: How to target just .XLS extension and not implicitly .XLSX ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Quote Originally Posted by gmayor View Post
    Check the last few characters e.g
    If Right(UCase(objAtt.FileName), 4) = ".XLS" Then
    Hello,
    Thanks for your reply. I tried the above code but it still grabs the .XLSX, perhaps because if it checks for the last 4 characters to be .XLS, the .XLSX also contains .XLS hence it grabs the .XLSX

    I was thinking of doing sort of a MatchCase if possible or an If statement to do nothing (Exit Sub) on .XLSX



    Edit: Tried this for the MatchCase but didn't work
    If Dir(stFileName) = "" Then
    If UCase(objAtt.DisplayName) = ".XLS" and UCase(objAtt.DisplayName) <> ".XLSX" Then
    If InStr(objAtt, "Media") > 0 Then
    objAtt.SaveAsFile saveFolder & objAtt.DisplayName
    End If
    If InStr(objAtt, "Media") > 0 Then
    objAtt.SaveAsFile saveFolder & objAtt.DisplayName
    End If
    End If
    Last edited by johngalvin; 10-05-2019 at 12:28 AM.

Posting Permissions

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