Can anyone point me to an example of code that will get information from an excel file?
Thanks.
Can anyone point me to an example of code that will get information from an excel file?
Thanks.
one way of doing it is to import the excel file as a table into access
try DoCmd.TransferSpreadsheet
Example:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "Sheet1", "C:\test.xls", True, "Sheet1$"
Green: Name of the table in the database in which the info will be saved.
Blue: Complete Path reference of the xls file with the file name and extension.
Red: Reference to the Sheet on the workbook from which data is to be imported.
That worked great, is there anyway to make the sheet just be the first sheet without knowing the name of the sheet?
Now that I am thinking about it, the sheet name is always the last part of the file path I am passing which is your Blue Item. For example:
C:\Documents and Settings\blah\Desktop\Personal\exfile.xls
The excel sheet seems to name itself the same as the file name, in this case exfile, I have the whole path saved as a variable, how do I break that variable down into just the file name?
if you don't put the range data from the first sheet is imported.
Regarding your second question its not clear to me what you want to do. anyways if this solves your problem mark the thread solved.