davidjearly
Registered User.
- Local time
- Today, 02:10
- Joined
- Apr 30, 2009
- Messages
- 40
Hi folks,
I am using the following code in one of my databases, and it is working as it should but not as I would like it to.
[/SIZE]
Is there any way that this can be modified to only import a named range in the selected workbook that is navigated to? The named range would be called 'IMPORT'.
Many thanks in advance for your help.
I am using the following code in one of my databases, and it is working as it should but not as I would like it to.
Code:
[SIZE=2]Dim strPathFile As String
Dim strTable As String, strBrowseMsg As String
Dim strFilter As String, strInitialDirectory As String
Dim blnHasFieldNames As Boolean[/SIZE]
[SIZE=2]
blnHasFieldNames = False
[/SIZE][SIZE=2]strBrowseMsg = "Select the EXCEL file:"[/SIZE]
[SIZE=2]
strInitialDirectory = "C:\MyFolder\"
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.xls")
[/SIZE][SIZE=2]strPathFile = ahtCommonFileOpenSave(InitialDir:=strInitialDirectory, _
Filter:=strFilter, OpenFile:=False, _
DialogTitle:=strBrowseMsg, _
Flags:=ahtOFN_HIDEREADONLY)[/SIZE]
[SIZE=2]If strPathFile = "" Then
MsgBox "No file was selected.", vbOK, "No Selection"
Exit Sub
End If
strTable = "tablename"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames
Is there any way that this can be modified to only import a named range in the selected workbook that is navigated to? The named range would be called 'IMPORT'.
Many thanks in advance for your help.