Control Name

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Can someone please tell me the name of the control that allows you to browse
the directories and folders. I would like to be able to browse to an excel
file in "My Documents" to import. And second can I do this from my Import
spreadsheet macro?

Thanks
Richard
 
Richard said:
Can someone please tell me the name of the control that allows you to
browse
the directories and folders. I would like to be able to browse to an excel
file in "My Documents" to import. And second can I do this from my Import
spreadsheet macro?

Thanks
Richard



In 2002 and later, you can place a button on a form, and the code behind
that button can be:

Dim f As FileDialog

Set f = Application.FileDialog(msoFileDialogFilePicker)
f.Filters.Clear
f.Filters.Add "Excel", "*.xls", 1
f.Show

DoCmd.TransferSpreadsheet acImport, , "myTable", f.SelectedItems(1)


In the above, you have to change "myTable" to the name of the table you want
the data to go into...

I not 100%, but the FileDialog feature might have only been added to access
2003 and later. So,if you have a earlier version...there is other code
possibilities, but the above is the least amount of code.
 
Thank you Albert

Albert D. Kallal said:
In 2002 and later, you can place a button on a form, and the code behind
that button can be:

Dim f As FileDialog

Set f = Application.FileDialog(msoFileDialogFilePicker)
f.Filters.Clear
f.Filters.Add "Excel", "*.xls", 1
f.Show

DoCmd.TransferSpreadsheet acImport, , "myTable", f.SelectedItems(1)


In the above, you have to change "myTable" to the name of the table you want
the data to go into...

I not 100%, but the FileDialog feature might have only been added to access
2003 and later. So,if you have a earlier version...there is other code
possibilities, but the above is the least amount of code.
 
Richard said:
Can someone please tell me the name of the control that allows you to
browse
the directories and folders. I would like to be able to browse to an excel
file in "My Documents" to import. And second can I do this from my Import
spreadsheet macro?

Thanks
Richard
 
Back
Top