Notifications
Clear all

Identificar discos

7 Posts
2 Usuários
0 Reactions
811 Visualizações
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Existe algum código que possa usar para identificar quais discos existem na maquina, inclusive aqueles mapeados da rede? para disponibilizar numa lista de discos disponiveis para salvamento.

Tipo assim : " Escolha o disco para salvamento" e abrir uma cx com os discos possiveis

 
Postado : 29/04/2014 6:54 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa noite!!

Os tais discos, seria diretórios?

Att

 
Postado : 29/04/2014 7:09 pm
(@gtsalikis)
Posts: 2373
Noble Member
 

creio q seriam os drives:

C:
D:

etc...

Aqui tem alguma informação:
http://www.macoratti.net/vbn5_drv.htm

 
Postado : 29/04/2014 7:47 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

isso discos = drives=hd

 
Postado : 29/04/2014 7:48 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa noite!!

Seria isso?

Sub AleVBA_11489()
    Dim Drive As Object, HardDrive$
    For Each Drive In CreateObject("Scripting.FileSystemObject").Drives
          If Drive.DriveType = 2 Then
                HardDrive = Drive
          End If
    Next
    MsgBox HardDrive
End Sub

Att

 
Postado : 29/04/2014 8:01 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Porque só identificou o D: , tenho o C: e estou com 2 pen drives espetados aqui

 
Postado : 29/04/2014 8:04 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Bom dia!!

tente

Sub AleVBA_11489V2()

    Dim Drive As Object, MyDrives As String
     
    For Each Drive In CreateObject("Scripting.FileSystemObject").Drives
        If Drive.DriveType > 1 Then
            MyDrives = Drive & vbNewLine & MyDrives
        End If
    Next
     
    MsgBox MyDrives
     
End Sub

Att

 
Postado : 30/04/2014 5:58 am