Sub entrando_no_padrão()
Application.DisplayAlerts = False
Dim fld As Object
Dim fld2 As Object
Dim fld3 As Object
Dim fld4 As Object
Dim fld5 As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set fso3 = CreateObject("Scripting.FileSystemObject")
Set fso4 = CreateObject("Scripting.FileSystemObject")
Set fso5 = CreateObject("Scripting.FileSystemObject")
Dim ver_num As Integer
ver_num = 0
Set fld = fso.GetFolder("C:")
n = 1
y = 1
For Each fld In fld.SubFolders
If fld <> "ESSE_NOME_NÃO_ENTRA" Then
Set fld2 = fso2.GetFolder("C:\" & fld.Name)
For Each fld2 In fld2.SubFolders
If Len(Dir("C:\" & fld.Name & "\" & fld2.Name & "\PCP- Planos de controle", vbDirectory) & "") > 0 Then
Set fld3 = fso3.GetFolder("C:\" & fld.Name & "\" & fld2.Name & "\PCP- Planos de controle")
For Each fld3 In fld3.Files
Call PADRONIZAR(fld.Name, fld2.Name, fld3.Name)
SendKeys "%f" & "p" & "^{TAB}" & "{+}" & "{TAB}" & "34670920" & "{TAB}" & "34670920" & "{TAB}" & "~" & "%{F4}"
Next fld3
End If
If Len(Dir("C:\" & fld.Name & "\" & fld2.Name & "\PEP - Plano de embalagem", vbDirectory) & "") > 0 Then
Set fld4 = fso4.GetFolder("C:\" & fld.Name & "\" & fld2.Name & "\PEP - Plano de embalagem")
For Each fld4 In fld4.Files
Call PADRONIZAR(fld.Name, fld2.Name, fld4.Name)
SendKeys "%f" & "p" & "^{TAB}" & "{+}" & "{TAB}" & "34670920" & "{TAB}" & "34670920" & "{TAB}" & "~" & "%{F4}"
Next fld4
End If
If Len(Dir("C:\" & fld.Name & "\" & fld2.Name & "\FIT - Ficha de Instrução de Trabalho", vbDirectory) & "") > 0 Then
Set fld5 = fso5.GetFolder("C:\" & fld.Name & "\" & fld2.Name & "\FIT - Ficha de Instrução de Trabalho")
For Each fld5 In fld5.Files
Call PADRONIZAR(fld.Name, fld2.Name, fld5.Name)
SendKeys "%f" & "p" & "^{TAB}" & "{+}" & "{TAB}" & "34670920" & "{TAB}" & "34670920" & "{TAB}" & "~" & "%{F4}"
Next fld5
End If
Next fld2
End If
Next fld
If x <> x Then
final:
Open "\caminha\para\abrir\um\txt" For Append As #2
Print #2, fld2.Path
Close #2
End If
Application.DisplayAlerts = True
End Sub
That's it for now.