Excel Data Import

J

Jay

I have this Access 97 application into which Excel data set by a range is
imported. The only thing is that the excel sheet name keeps getting it's name
changed, though the range remains the same. Below is a sample of code calling
a macro to run that will be doing this import process. Sample of the macro
setup follows,
'====================================
Transfer type: Import
Spreadsheet Type: Microsoft Excel 97
Table Name: tbl_Lenz_Shipped_data
File Name: =GetFilename1() (Funxtion Call)
Has Field Names: No
Range: July04!A2:Ah59
'====================================
Sample API call code for Dialog box to navigate to target locaton and pick
file:
'====================================
Public Function ImportShipmentWorkBook_To_Temp()
Dim strFileName1 As String, strErrorMsg As String, strSheetName1 As
String, OKToImport As Boolean
strErrorMsg = "There was an error trying to do the import from "
'SetFileName1
'Data import process begins here. All sheets within any Excel workbook
that match the criteria can be targeted for import
OKToImport = CheckFileStatus
On Error GoTo ImportError
If OKToImport = True Then
DeleteTempTableData
DoCmd.SetWarnings False
strSheetName1 = " " 'Here on the left, I've left the sheet name
blank so as to allow for various names. The commented out sheet name code
below shows how the code previously read.
'strSheetName1 = "July04. "
DoCmd.RunMacro "mcr_Import_Shipment_Data"
Else
MsgBox ("File could not be imported!")
End If
'======================================
Is there a simpler method of doing this? If there is how? Time is constrains
have been placed on this to get it done. Any assistance will be
appreciated!!!!!

If you need more details on this, do not hesitate to ask.......
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top