Notifications
Clear all

GetOpenFile ou FilePicker

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

Boa tarde,
eu preciso criar algum procedimento em um botão que realize o seguinte: Abra uma caixa de procura de arquivo e ao selecionar o arquivo (um único arquivo), ele salve o endereço completo do arquivo em uma variável. Com esta variável contendo o endereço do arquivo, eu poderia utilizá-la em em um comando para poder importar um arquivo.
Eu estava utilizando o seguinte:

Public Function OpenFileDialog() As String
Dim Filter As String, Title As String
Dim FilterIndex As Integer
Dim Filename As Variant
Filter = "Arquivos Excel (*.xlsx),*.xlsx,"
FilterIndex = 3
Title = "Selecione um arquivo"
ChDrive ("C")
ChDir ("C:")
With Application
Filename = .GetOpenFilename(Filter, FilterIndex, Title)
ChDrive (Left(.DefaultFilePath, 1))
ChDir (.DefaultFilePath)
End With
If Filename = False Then
MsgBox "Nenhum arquivo foi selecionado."
Exit Function
End If
OpenFileDialog = Filename
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TOPOGRAFIA", Filename, True, "TOPOGRAFIA!

End Function

Mas não estou conseguindo. Como posso proceder?

 
Postado : 26/04/2012 12:38 pm
(@tomamais)
Posts: 26
Eminent Member
 

Colega,

Isso dá uma luz?

http://www.tomasvasquez.com.br/blog/mic ... filedialog

Abraços

 
Postado : 16/05/2012 10:24 am