Code:
Dim oFile As Object, oFolder As Object
Set oFolder = CreateObject("scripting.filesystemobject").GetFolder("C:\")
For Each oFile In oFolder.Files
If InStr(1, oFile.Name, ".pdf", vbTextCompare) Then MsgBox oFile.Path Else: Next oFile
...
Next oFile
End Sub
Naturally the above will throw up a "Next w/o For" error. Is there anyway to have a oneline if that can contain a next in the else? Or code that effectively does the same.
Reason being, I have a fair number of nested if statements that come after the above in the example.