0

I have code in an Access database.

Private Sub Text0_Click()
    Dim s As String

    s = MyGetOpenFileName

    Me.Text0.Value = s
End Sub

In Windows 7 Office 2010 when I click the text box the windows open.

In Windows 10 Office 2013 nothing happens.

Community
  • 1
  • 1
Riufaan
  • 43
  • 1
  • 1
  • 5

1 Answers1

1

I think this should work:

Dim OpenFile As Workbook

fPath = Application.GetOpenFilename(FileFilter:="Excel files, *.xl; *.xlsx; *.xlsm; *.xlsb; *.xlam; *.xltx; *.xls; *.xlt ", Title:="You can type the title for Your window here")

If fPath = False Then
    Exit Sub
End If

Set OpenedFile = Workbooks.Open(fileName:=fPath, UpdateLinks:=0, IgnoreReadOnlyRecommended:=True)

I show the window with filter to excel files and then check if file is seleted if true then I open file.

Mikisz
  • 404
  • 5
  • 20
  • sorry this code give me a compiler error (user - defined type not defined) – Riufaan Apr 05 '17 at 08:06
  • 1
    Ok, I've seen that Your question is taged with Excel, so my code was for excel vba. I think that for access database might be helpful this topic: http://stackoverflow.com/questions/1091484/how-to-show-open-file-dialog-in-access-2007-vba – Mikisz Apr 18 '17 at 13:50