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

Transferspreadsheet - simple question

I am new to VBA coding, but I read through the MSAccess instructions and a bunch of forum postings and I still can't figure out my question:

Could someone please lay it out for me how to use TransferSpreadsheet or OutputTo to send the output from two Access queries into two different tabs in one Excel file?

I have found bits and pieces of the answer all over the internet and I can't figure out how to put them together! :) Thanks.

Kara
Jun 27 '06 #1
3 6126
PEB
1,418 Expert 1GB
I am new to VBA coding, but I read through the MSAccess instructions and a bunch of forum postings and I still can't figure out my question:

Could someone please lay it out for me how to use TransferSpreadsheet or OutputTo to send the output from two Access queries into two different tabs in one Excel file?

I have found bits and pieces of the answer all over the internet and I can't figure out how to put them together! :) Thanks.

Kara
Hi,

Maybe your question isn't so easy

This command transfers the data but on only one sheet!

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"Employees","C:\my_file.xls", True, ""


For more sheets you need to consult so you have to refer to:

Working Across Applications

In the Access Basic help...

Visual Basic can create new objects and retrieve existing objects from many Microsoft applications. Other applications may also provide objects that you can create using Visual Basic. See the application's documentation for more information.

To create an new object or get an existing object from another application, use the CreateObject function or GetObject function:

' Start Microsoft Excel and create a new Worksheet object.
Set ExcelWorksheet = CreateObject("Excel.Sheet")

' Start Microsoft Excel and open an existing Worksheet object.
Set ExcelWorksheet = GetObject("SHEET1.XLS")

' Start Microsoft Word.
Set WordBasic = CreateObject("Word.Basic")

Most applications provide an Exit or Quit method that closes the application whether or not it is visible. For more information on the objects, methods, and properties an application provides, see the application's documentation.

Some applications allow you to use the New keyword to create an object of any class that exists in its type library. For example:

Dim X As New Field

In this case, Field is an example of a class in the data access type library. A new instance of a Field object is created using this syntax. Refer to the application's documentation for information about which object classes can be created in this way.


Hope that's given some directions

:)
Sep 9 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
If you use DoCmd.TransferSpreadsheet to send two different objects to an excel file. They should default to two different worksheets with the worksheets automatically given the object names.

Try it and see.


I am new to VBA coding, but I read through the MSAccess instructions and a bunch of forum postings and I still can't figure out my question:

Could someone please lay it out for me how to use TransferSpreadsheet or OutputTo to send the output from two Access queries into two different tabs in one Excel file?

I have found bits and pieces of the answer all over the internet and I can't figure out how to put them together! :) Thanks.

Kara
Sep 9 '06 #3
PEB
1,418 Expert 1GB
If you use DoCmd.TransferSpreadsheet to send two different objects to an excel file. They should default to two different worksheets with the worksheets automatically given the object names.

Try it and see.
In the Access Basic help i've seen that if you specify the sheet or the range there is no export because of fault... Microsoft wants to be blank there as range!
;(
Sep 9 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: O'Donnell Tribunal | last post by:
Hello Everybody, I am using the TransferSpreadsheet method to import spreadsheets for processing. say my code looks like this: DoCmd.TransferSpreadsheet acImport, 0, _ "tbltempImport1", ""...
0
by: Mick Hardy | last post by:
Hi, Has anyone seen this weird behaviour or have any suggestions or can anyone reproduce it? The history: I converted a large third party DB from 97 to XP and it uses the...
1
by: Bill Agee | last post by:
How do you specify a specific worksheet? I know this works if the worksheet in question is the 1st, but suppose I am interested in importing several worksheets from the same workbook. There does...
3
by: user_5701 | last post by:
Hello, I'm getting an error with a Docmd.Transferspreadsheet line of code: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel2000, "tblTest", pathAndFilename, True The above line...
1
by: Brad | last post by:
Thanks for taking the time to read my question. I want to use SQL in the TransferSpreadsheet Method, but I can't get it to work. I don't know why, because I've done a debug.pring on the same...
2
by: Quique | last post by:
Hello, I've got a problem importing a worksheet Excel into a temporary table in access. All the information is imported but the table is not ordered as it is originally in excel. I'm using a...
2
by: rlntemp-gng | last post by:
re:Access 2003 TransferSpreadsheet has worked in my app for weeks now. Now, the day I was to put in production (today) it crashes the app, and users are livid...but not more than me...
5
by: D.Stone | last post by:
I'm getting a problem with importing an Excel spreadsheet into a table in a SQL Server 2000 back-end. I'm doing this in VBA in an onClick event proc in an Access 2003 project. The target table's...
3
by: Icarus | last post by:
I'm using TransferSpreadsheet to import an Excel file in to MS Access 2003. DoCmd.TransferSpreadsheet acImport, 8, strTable, strFileName, True, "" One of the columns in the Excel file is a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.