PEGAR NOME DO ARQUIVO
Olá,
Como faço para pegar o nome do arquivo que o usuário seleciona no commondialog? Eu tentei usar a propriedade filename, mas ela retorna o diretorio completo (ex:C:\Pasta
omearquivo). Eu queira pegar somente o nome do arquivo. Como faço? Obrigado.
Luiz
Como faço para pegar o nome do arquivo que o usuário seleciona no commondialog? Eu tentei usar a propriedade filename, mas ela retorna o diretorio completo (ex:C:\Pasta
omearquivo). Eu queira pegar somente o nome do arquivo. Como faço? Obrigado.
Luiz
Veja:
http://www.vbmania.com.br/vbmdetail.php?varID=2944
http://www.vbmania.com.br/vbmdetail.php?varID=2944
Esse código parte dele eu devo ao amigo MIGUEL_ANGELO, ele me tirou uma dúvida de como retirar a árvore de um diretóio e deixar somente o nome do arquivo:
'-----RETIRAR A à ÂRVORE DE UM DIRETÓ“RIO POR MIGUEL_ANGELO:
'usaremos um Text Box e um Botão:
Private Sub Command1_Click()
Dim Arquivo() As String
Dim DiretorioArq As String
DiretorioArq = Text1.Text
Arquivo = Split(DiretorioArq, "\")
Text1.Text = Arquivo(UBound(Arquivo))
End Sub
'-----RETIRAR O NOME DO ARQUIVO DE UM STRING DO TIPO ( DIRETÓ“RIO + ARQUIVO) POR GABRIEL_LOGAN
'usaremos 2 Text Box e um Botão:
Private Sub Command1_Click()
Dim Arquivo() As String
Dim DiretorioArq As String
Dim vla As Integer
DiretorioArq = Text1.Text
Arquivo = Split(DiretorioArq, "\")
Text2.Text = Arquivo(UBound(Arquivo))
Text1.SelStart = 0
Text2.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text2.SelLength = Len(Text2.Text)
vla = Text1.SelLength - Text2.SelLength
Text1.Text = Left$(Text1.Text, InStr(Text1.Text, "\") + (vla - 3))
End Sub
Private Sub Form_Load()
Text2.Visible = False
End Sub
'Pra finalizar Vejam:
RETIRANDO A EXTENSÃO DO ARQUIVO:
'==========
Arquivo$ = Left$(Arquivo$, InStr(Arquivo$, ".") - 1)
'==========
Valeu Gabriel.
Luiz
Luiz
Estamos ai pra isso.
Tópico encerrado , respostas não são mais permitidas