I have a function that looks for open workbooks and pulls them into a master workbook. It works just fine when I'm importing a workbook created with a modern version of office, but it doesn't seem to detect workbooks that open in compatibility mode. Only the left 24 characters are constant for the workbook in question.
For a wide variety of reasons I've gone over in other posts downloading the workbook in question is not an option.
Here is the function.
Public Sub FindReport()
Debug.Print "Finding Report"
On Error GoTo Failed
Dim rName() As String
Dim wb As Workbook
Dim tWb As Workbook
rName(0) = "Case Detail"
rName(1) = "Disability_Claim_Status_"
'rName(2) = "placeholder"
For Each wb In Workbooks
'This line gives no output when I have the function try to find a workbook
'that has opened in compatibility mode
Debug.Print wb.Name
If Left(wb.Name, 11) = rName(0) Then
Set tWb = wb
ImportReport tWb
tWb.Close
CaseFAS
Exit For
End If
If Left(wb.Name, 24) = rName(1) Then
Set tWb = wb
ImportReport tWb
tWb.Close
'CaseFAS
Exit For
End If
'If Left(wb.Name, 11) = rName(2) Then
' Set tWb = wb
' ImportReport tWb
' tWb.Close
' 'CaseFAS
' Exit For
'End If
Next wb
Failed:
End Sub
EDIT for clarification:
I had another version of this code that pulled in a specific worksheet that opens from a website, now that I need to expand it to handle another sheet I modified the declarations accordingly, and screwed up declaring the array.