-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenom.bas
More file actions
61 lines (41 loc) · 1.43 KB
/
renom.bas
File metadata and controls
61 lines (41 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
----- isto aqui é so exemplo
Sub lista_arquivos()
Dim pasta As String
Dim linha As Integer
Dim arquivo As String
Dim x As Integer
linha = 7
'Pega o caminho completo da pasta
pasta = InputBox("Digite o caminho da pasta" + Chr(13) + Chr(13) + "É preciso terminar com a barra \ final", "LISTA ARQUIVOS", Cells(5, 6))
Cells(5, 6) = pasta
'Cabeçalho
Cells(linha, 2) = "Nome do Arquivo"
Range("A1:C1").Font.Bold = True
linha = linha + 1
'Lista o primeiro arquivo da pasta
arquivo = Dir(pasta, 7)
Cells(linha, 2) = arquivo
'Lista os arquivos restantes
Do While arquivo <> "" ' And linha <= Cells(10, 7)
arquivo = Dir
If arquivo <> "" Then ' Or linha > Cells(10, 7) Then
linha = linha + 1
Cells(linha, 2) = arquivo
End If
Loop
Cells(7, 8) = linha
Do While Cells(linha + 1, 2) <> ""
linha = linha + 1
Cells(linha, 2) = ""
Loop
End Sub
Sub renomeia()
Dim pasta As String
Dim linha As Integer
pasta = InputBox("Confirme a pasta" + Chr(13) + Chr(13) + "É preciso terminar com a barra \ final", "RENOMEIA CONFORME JÁ TÁ APARECENDO ABAIXO", Cells(5, 6))
Cells(5, 6) = pasta
linha = Cells(7, 8)
For x = 8 To linha
Name pasta + Cells(x, 2) As pasta + Cells(x, 3)
Next x
End Sub