The following code allows you to link (not import) a HTML datasheet to a MS Access database using VBA code.
'*****************************************************
'****************SELECTING A FILE LOCATION****************
'*****************************************************
'ATTENTION: YOU MUST go to Tools->References and select 'Microsoft Office X.X object Library' for
'the FileDialog function to work properly
Dim retFile As String, dlg As Variant, s As String
Set dlg = Application.FileDialog(msoFileDialogFilePicker)
With dlg
'This is the title of the browser window you will use to select the file path.
.Title = "Select a Latitude Longitude Snapshot File"
.AllowMultiSelect = False
' Name and select the file type. *.* will show all file types
.Filters.Add "Snapshot files", "*.html"
' The initial file name can be anything you choose, the example below will start you at the root of your "C" drive
' .InitialFileName = "c:\"
If .Show = -1 Then s = .SelectedItems(1)
End With
If s <> "" Then
'*** retFile stores the full path to the selected file ***
retFile = s
End If
'*** Linking the Acess DB to the HTML datasheet ***
'*** Once the link is complete, it will display in access as a table. Following we declare a tab name. ***
Dim tabName As String
tabName = "LatLon"
DoCmd.TransferText acLinkHTML, , tabName, retFile, -1