473,729 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7585
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.TransferS preadsheet acExport, 8, "TableDataComin gFrom",
"PathAndNameFor ExcelFile" -1
acExport means it is outbound
8 means that it is Access 97 or later
-1 means use fieldNames as column titles

Example
DoCmd.TransferS preadsheet acExport, 8, "tblClients ",
"c:\ExcelWbs\Cl ientWB.xls", -1
<hm*****@hartfo rd.eduwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.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********@com cast.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.TransferS preadsheet acExport, 8, "TableDataComin gFrom",
"PathAndNameFor ExcelFile" -1
acExport means it is outbound
8 means that it is Access 97 or later
-1 means use fieldNames as column titles

Example
DoCmd.TransferS preadsheet acExport, 8, "tblClients ",
"c:\ExcelWbs\Cl ientWB.xls", -1
<hm*****@hartfo rd.eduwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.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:GetExterna l: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*****@hartfo rd.eduwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.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*****@hartfo rd.edu" <hm*****@hartfo rd.eduwrote in
news:11******** **************@ m73g2000cwd.goo glegroups.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
18571
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 * INTO XLSTest IN 'C:\' 'Excel 8.0;' FROM Table1" g.ExecuteNonQuery()
9
22501
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 namespaces and classes should I use and how? -- dba123
3
4116
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 export th result. How do I set about this?
0
3065
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 determined that if I take out the line that copies the temp array to cells in a worksheet, Access will close the Excel file. If the line is there, Excel remains open and blocks more runs of the same procedure. If I close Access, Excel gets closed. Looks like...
12
7136
by: cmghosh | last post by:
how to transfer excel worksheet data to mysql table?
2
1672
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 in the worksheet. Clara thank you so much for your help
7
12071
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
2115
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 how to do this please help!
1
5592
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 code so far (that works) to dump in the data and create a chart based off it... except I have to manually alter the data I dumped in into a pivot table for the chart to make sense every time.... it sure would be nice if VBA would do it for me! Heres...
0
8921
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9202
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9148
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.