Preciso de um código em VBA que realize uma condição verifique se existem pastas em um diretorio e caso haja exclua todas as pastas já tenteni concater Rndir arquivo cells(1. "A") entrte outros mais não estou tendo sucesso

Andre 1 Reputation point
2021-09-25T22:57:35.917+00:00

Private Sub CommandButton1_Click()

raiz = "C:\Users\mxxxx\OneDrivexxxDocuments\01 - xxxxxx\04 - Logs\1 - Enviar por e-mail\New folder\"

For linha = 1 To 60

pasta = raiz & Cells(1, "A").Value & "\"

tipo = "*.*"

arquivo = Dir(pasta & tipo)

Do Until arquivo = ""



    Kill pasta & arquivo

    arquivo = Dir()

  Kill pasta

  Else

  Kill pasta
  End If

Loop

Next

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,947 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dave Patrick 426.1K Reputation points MVP
    2021-09-25T23:19:54.733+00:00

    Q&A forums are currently English only. I'd try asking for help over here in dedicated forums.
    https://social.msdn.microsoft.com/Forums/pt-br/home
    https://social.technet.microsoft.com/Forums/pt-br/home
    https://answers.microsoft.com/pt-br

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments