473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Importing multiple Excel workbooks from Access

Function TS_Import()
On Error GoTo TS_Import_Err
Dim TS As Integer

' Sample Worbook names : 00498, 40194 etc...

DoCmd.SetWarnings False
For TS = 1 To 99999
DoCmd.TransferSpreadsheet acImport, 8, "Staff", "L:\Time\" &
Format(TS, "00000") & ".xls", True, "Summary!"
Next TS

DoCmd.SetWarnings True
TS_Import_Exit:
Exit Function

TS_Import_Err:
Resume Next
Resume TS_Import_Exit

End Function

'Where did I go wrong ? Thank you for your help. Celeste Edwards.

Nov 13 '05 #1
3 1237
What is wrong?

--

Ken Snell
<MS ACCESS MVP>

"u473" <u4**@aol.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Function TS_Import()
On Error GoTo TS_Import_Err
Dim TS As Integer

' Sample Worbook names : 00498, 40194 etc...

DoCmd.SetWarnings False
For TS = 1 To 99999
DoCmd.TransferSpreadsheet acImport, 8, "Staff", "L:\Time\" &
Format(TS, "00000") & ".xls", True, "Summary!"
Next TS

DoCmd.SetWarnings True
TS_Import_Exit:
Exit Function

TS_Import_Err:
Resume Next
Resume TS_Import_Exit

End Function

'Where did I go wrong ? Thank you for your help. Celeste Edwards.

Nov 13 '05 #2

It does not produce the expected result. No imported workbook.
I suspect my format criteria is the culprit.

Thank you for your help.

C.E.

Nov 13 '05 #3
One problem is that you're using an Integer variable for numbers that are
larger than what an Integer can handle (32,767); you're trying to use it up
to 99,999. Change TS to a Long variable type.

--

Ken Snell
<MS ACCESS MVP>

"u473" <u4**@aol.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...

It does not produce the expected result. No imported workbook.
I suspect my format criteria is the culprit.

Thank you for your help.

C.E.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mr. Bungle | last post by:
When importing excel from access I am fully aware that one can import directly into a table. Can you get as specific via code or something to import data from an excel sheet to a FORM (Not Table)...
2
by: RustyR | last post by:
Hi, I have 5 excel spreadsheets that are exported to me weekly. At first, I could not get them to import. Then I did a File -> Save as and noticed that the Filenames of the spreadsheets...
0
by: Jack | last post by:
Windows 2K Pro Access/Excel 2003 Hi there, I have a large number of password protected Excel Workbooks. The files are protected by code that runs when the workbook opens. The code asks the...
9
by: jillandgordon | last post by:
I am trying to import an excel file into Access 97. It looks perfectly all right but, every time I try to import it, I get to the lst step and am told that it was not imported due to an error. ...
4
by: sunilkeswani | last post by:
I need help with exporting data from 2 access tables, into 2 existing spreadsheets in a single Excel file. Currently, I am using this code: DoCmd.TransferSpreadsheet acExport, 8, "Table1",...
0
by: Anish G | last post by:
Hi All, I am getting the below given error while running my application in live server. In my local machine, its working fine. Please help me as it is very urgent for me. Exception from...
3
by: smugcool | last post by:
hi to all experts, I wrote a macro code, i got stuck in between as i am trying to import multiple excel workbooks variious sheets into an active worksheet. Requsting you to revert where i am...
0
by: DrewYK | last post by:
I have the project that may never end in front of me. I am creating a routine that will take SpreadSheets from Excel and bring them into Access. I am not using any "DoCmd"s because the goal...
22
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.