Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Private Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type Private Function Prueba() As String Dim OFName As OPENFILENAME OFName.lStructSize = Len(OFName) OFName.lpstrFilter = "Ficheros de Texto (*.txt)" + Chr$(0) + "*.txt" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0) OFName.lpstrFile = Space$(254) OFName.nMaxFile = 255 OFName.lpstrFileTitle = Space$(254) OFName.nMaxFileTitle = 255 OFName.lpstrInitialDir = "C:\" OFName.lpstrTitle = "Abrir Fichero" OFName.flags = 0 'Muestra el dialogo If GetOpenFileName(OFName) Then Prueba = Trim$(OFName.lpstrFile) Else Prueba = "" End If End Function