473,395 Members | 1,641 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,395 software developers and data experts.

Transfer Table to Existing Excel Worksheet

Hey there folks:

I have been trying to get this work for about a week now. I'm new to
VBA...

I am trying to transfer a populated table in Access to an existing, but
blank, Excel worksheet. I have seen methods for transfering cell by
cell, and understand how to get that to work. However, my recordset has
3600 cells of data. Cell by cell is just not an option. I am looking
for a way to specify the starting cell (most upper left cell) in Excel,
and then just drop the Access table into the worksheet.

The table is 36 columns wide and 100 rows tall.

Both the Access table and the existing Excel worksheet have the exact
same formatting. It's just a matter of effieciently transfering this
large amount of data.

Thanks for your help...

Oct 13 '06 #1
5 7549
This will transfer the entire table to the Excel File you name. You don't
need to create
the recipient file. This will create it for you. It will also set the first
row as column names
which it will take from the table fieldnames.

In a VBA Module within the database that has the table of interest enter

DoCmd.TransferSpreadsheet acExport, 8, "TableDataComingFrom",
"PathAndNameForExcelFile" -1
acExport means it is outbound
8 means that it is Access 97 or later
-1 means use fieldNames as column titles

Example
DoCmd.TransferSpreadsheet acExport, 8, "tblClients",
"c:\ExcelWbs\ClientWB.xls", -1
<hm*****@hartford.eduwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hey there folks:

I have been trying to get this work for about a week now. I'm new to
VBA...

I am trying to transfer a populated table in Access to an existing, but
blank, Excel worksheet. I have seen methods for transfering cell by
cell, and understand how to get that to work. However, my recordset has
3600 cells of data. Cell by cell is just not an option. I am looking
for a way to specify the starting cell (most upper left cell) in Excel,
and then just drop the Access table into the worksheet.

The table is 36 columns wide and 100 rows tall.

Both the Access table and the existing Excel worksheet have the exact
same formatting. It's just a matter of effieciently transfering this
large amount of data.

Thanks for your help...

Oct 13 '06 #2
Just to be clear the DoCmd lines below have been broken by the message
software.
The line immediately under each DoCmd line has to be part of the DoCmd line
"Kc-Mass" <co********@comcast.netwrote in message
news:ac******************************@comcast.com. ..
This will transfer the entire table to the Excel File you name. You don't
need to create
the recipient file. This will create it for you. It will also set the
first row as column names
which it will take from the table fieldnames.

In a VBA Module within the database that has the table of interest enter

DoCmd.TransferSpreadsheet acExport, 8, "TableDataComingFrom",
"PathAndNameForExcelFile" -1
acExport means it is outbound
8 means that it is Access 97 or later
-1 means use fieldNames as column titles

Example
DoCmd.TransferSpreadsheet acExport, 8, "tblClients",
"c:\ExcelWbs\ClientWB.xls", -1
<hm*****@hartford.eduwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>Hey there folks:

I have been trying to get this work for about a week now. I'm new to
VBA...

I am trying to transfer a populated table in Access to an existing, but
blank, Excel worksheet. I have seen methods for transfering cell by
cell, and understand how to get that to work. However, my recordset has
3600 cells of data. Cell by cell is just not an option. I am looking
for a way to specify the starting cell (most upper left cell) in Excel,
and then just drop the Access table into the worksheet.

The table is 36 columns wide and 100 rows tall.

Both the Access table and the existing Excel worksheet have the exact
same formatting. It's just a matter of effieciently transfering this
large amount of data.

Thanks for your help...


Oct 13 '06 #3
I'm sorry I should have been more clear.

I can't create a new worksheet in the existing Excel workbook.

I need to export the Access table to a specific area in the existing
Excel worksheet so that the rest of the workbook can make INDIRECT
references to the specific cells.

I inherited the Excel workbook and the orginal creator took the time to
create all of the INDIRECT references. I don't want to have to go
through the entire workbook and redirect all of the INDIRECT references
to the new worksheets.

If I can drop the Access table directly into the existing Excel
worksheet then I don't need to recode/formulate the Excel workbook.

I was thinking an alternative to my problem might be to reference the
newly imported worksheets, from the DoCmd, as an array. But I don't
know how to refference an entire worksheet in Excel without setting a
range.

I want my final program to be hands off as much as possible. Just open
Access, see a MsgBox pop-up "All Set", and that's it.

Oct 13 '06 #4
Maybe your coming at this from the wrong side. Excel has a built in query
system (MS_Query). It is not part of the default install but is on the cd.

Go to Data:GetExternal:New Database Query

It will walk you through building the query against an Access DB. Save the
query.
Next time you want the data go run the saved query. It will load data to
the sheet and position of your choosing.

Bury it in a macro if you like.

<hm*****@hartford.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm sorry I should have been more clear.

I can't create a new worksheet in the existing Excel workbook.

I need to export the Access table to a specific area in the existing
Excel worksheet so that the rest of the workbook can make INDIRECT
references to the specific cells.

I inherited the Excel workbook and the orginal creator took the time to
create all of the INDIRECT references. I don't want to have to go
through the entire workbook and redirect all of the INDIRECT references
to the new worksheets.

If I can drop the Access table directly into the existing Excel
worksheet then I don't need to recode/formulate the Excel workbook.

I was thinking an alternative to my problem might be to reference the
newly imported worksheets, from the DoCmd, as an array. But I don't
know how to refference an entire worksheet in Excel without setting a
range.

I want my final program to be hands off as much as possible. Just open
Access, see a MsgBox pop-up "All Set", and that's it.

Oct 13 '06 #5
"hm*****@hartford.edu" <hm*****@hartford.eduwrote in
news:11**********************@m73g2000cwd.googlegr oups.com:
I'm sorry I should have been more clear.

I can't create a new worksheet in the existing Excel workbook.
I doubt that.
>
I need to export the Access table to a specific area in the
existing Excel worksheet so that the rest of the workbook can
make INDIRECT references to the specific cells.
Maybe you could transfer the data to the new worksheet, then run a
macro to cut the data from the new sheet and paste it into the
final destination, then delete the sheet added above.

All is easy enough to do in code.
>
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Oct 13 '06 #6

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

Similar topics

6
by: Sam Johnson | last post by:
HI I tried to send the following SQL string to an open databse, to export a table into excel format: g.Connection = conn 'valid OleDBConnection and Command objects g.CommandText = "SELECT *...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
3
by: JohnM | last post by:
I can transfer from a query with DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Filenam", CPath, True I would like to use a form for the user to select and order data then...
0
by: blainegray | last post by:
Greetings This is one of those Access is not closing Excel problems. The first time through the code works fine. The second time there is a problem. After lots of combinations, I finally...
12
by: cmghosh | last post by:
how to transfer excel worksheet data to mysql table?
2
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, I have some data in a worksheet and need to be transfered to a table in SQL Server 2005 using VB 2005, the question is how can I manipulate the Excel object model and access to the data...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
1
by: zeeta999 | last post by:
I want to output the results from an access query to an existing excel worksheet within a workbook. I do not want to delete the worksheet as another worksheet is tied in with formulas. I have no idea...
1
by: CoreyReynolds | last post by:
I can't find any information on this. If I have an existing query and I want to dump it into a page on a spread sheet and modify it as a pivot table all in VBA, can I do that? I only have the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.