Well, I'm pretty stumped here. According to microsoft, GetFolder as an FSO method works with Absolute or Relative paths. And the thing is, I swear...I have a program out there that several users use every single day that uses this exact code...the ONLY thing I changed for the purpose of this post was the actual server, after the \\. the rest is even the same:
CODE
Dim FS As New FileSystemObject
Dim oFolder As Folder
Dim oFile As File
Dim ofolderDestin As String
Set oFolder = FS.GetFolder("\\SERVER\AllAFG_5602\DOCUMENT MANAGEMENT\Analyst Shared Files\Imaging\COLL-Warner Collections\TotalLoss\AllImaged\" & ThisWorkbook.Worksheets("Report").Range("J1").Value)
ofolderDestin = ("\\SERVER\data\5602\CRR\Production\CRR Image\NOITS Rejects")
For Each oFile In oFolder.Files
If InStr(Left(oFile.Name, 16), ".") Or InStr(oFile.Name, "[") Or InStr(oFile.Name, "]") Or InStr(oFile.Name, "pdf.pdf") Or InStr(oFile.Name, "doc.doc") Or InStr(oFile.Name, " ") Or InStr(oFile.Name, "?") Or Len(oFile.Name) < 21 Or InStr(oFile.Name, "-") Or Len(oFile.Name) > 26 Or Right(oFile.Name, 3) = "tmp" Or InStr(oFile.Name, "~") Or InStr(oFile.Name, "900.") Or Left(oFile.Name, 2) <> "50" Or InStr(oFile.Name, "!") Then
ThisWorkbook.Worksheets("Report").Range("A30").Value = ThisWorkbook.Worksheets("Report").Range("A30").Value + 1
ThisWorkbook.Worksheets("Report").Range("H65536").End(xlUp).Offset(1, 0).Value = oFile.Name
oFile.Move (ofolderDestin & "\" & Format(Now, "mmddyy-hhmm.") & oFile.Name)
End If
Next oFile
Secondly about the authorization, this server I"m already authenticated on it. If paste that absolute path in an explorer window and hit enter, it comes right up. I can use Dir() to test for file existence in that folder....I can Kill() files in that folder, all with no problem and no authentication.
Lastly, I just tested the Absolute vs. Relative possibility by mapping it to Z, and this gives me the exact same "Type mismatch" error.....What could possibly be a type mismatch about this - string argument???? I am so stumped.
CODE
Dim strMisMatch As String 'the sub-category of error, MU: text does not match file name.
Dim strMisMatch2 As String 'the sub-category of error, inner text-DATE does not match file name
Dim strDate1 As String
Dim strDate2 As String
Dim myFSO As New FileSystemObject
Dim myFolder As Folder
Dim myTextFile As TextStream
Dim oFile As File
Dim strTextLine As String
Dim intLine As Integer
Set myFolder = myFSO.GetFolder("Z:\Shared\CallCntrAnalyst\Report Analyst\CRC KPIs\Database\Source Files\IEX")
And where the heck did the insert special item-Codebox go in my UA reply?