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

Export a query to Excel

Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object, click no.
You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be replaced
and the other sheets in the Excel file remains unchanged. And this is watt I
want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command, only
replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon
Feb 11 '07 #1
5 31854
Simon wrote:
Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object, click no.
You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be replaced
and the other sheets in the Excel file remains unchanged. And this is watt I
want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command, only
replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon

Don't know. But perhaps you could try TransferSpreadsheet instead.

Enter
TransferSpreadsheet
in a code module, highlight it, and press F1.

Feb 11 '07 #2
TransferSpreadsheet is for import (Excel to Access) I am looking for export
(Access to Excel)

"salad" <oi*@vinegar.comschreef in bericht
news:j6**************@newsread3.news.pas.earthlink .net...
Simon wrote:
Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object, click
no.
You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be
replaced
and the other sheets in the Excel file remains unchanged. And this is
watt I
want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command,
only
replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon
Don't know. But perhaps you could try TransferSpreadsheet instead.

Enter
TransferSpreadsheet
in a code module, highlight it, and press F1.

Feb 12 '07 #3

"Simon" <Sv********@Versatel.nlwrote in message
news:45***********************@news.tele2.nl...
Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object, click
no.
You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be
replaced
and the other sheets in the Excel file remains unchanged. And this is watt
I
want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command,
only
replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon

You mention about replacing the Excel sheet. Are you talking about the
worksheet (e.g. Sheet1, Sheet2 etc) or do you mean the Excel workbook (e.g.
C:\test\Book1.xls)?

If you mean you want to check if the workbook exists and prompt to replace
it, check out the "Dir" function in the VBA help file and write some code
using this function to check if the files exists.

You also replied to Salad that TransferSpreadsheet is for importing. I also
ask you to check the VBA help file for this command.

Jeff
Feb 12 '07 #4
Simon wrote:
TransferSpreadsheet is for import (Excel to Access) I am looking for export
(Access to Excel)
That's new to me. You should be able to import, link, or export.
>
"salad" <oi*@vinegar.comschreef in bericht
news:j6**************@newsread3.news.pas.earthlink .net...
>>Simon wrote:

>>Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object, click

no.
>>>You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be

replaced
>>>and the other sheets in the Excel file remains unchanged. And this is

watt I
>>>want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command,

only
>>>replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon


Don't know. But perhaps you could try TransferSpreadsheet instead.

Enter
TransferSpreadsheet
in a code module, highlight it, and press F1.


Feb 12 '07 #5
Transferspreadsheet goes both ways.
"Simon" <Sv********@Versatel.nlwrote in message
news:45***********************@news.tele2.nl...
TransferSpreadsheet is for import (Excel to Access) I am looking for
export
(Access to Excel)

"salad" <oi*@vinegar.comschreef in bericht
news:j6**************@newsread3.news.pas.earthlink .net...
>Simon wrote:
Dear reader,

With the export command you can export a query to Excel.

By activate this command a form pop's up with the following text:

"The database object "Name.." already exist. Do you want to replace the
existing database object with the one you are exporting? If you want to
export this object without replacing the existing database object,
click
no.
You can then export the object again and rename it in the export dialog
box."

In case selecting [Yes] the Excel sheet with the same name will be
replaced
and the other sheets in the Excel file remains unchanged. And this is
watt I
want.

If I do the same with the following code:

DoCmd.OpenQuery "QueryName.."

DoCmd.RunCommand acCmdOutputToExcel

There is no warning that the Excel file exists and will be overwrite.

Is there code available with is doing the same as the "Export" command,
only
replacing the Excel sheet with the same name as the query.

Thanks for any help.

Kind regards,

Simon

Don't know. But perhaps you could try TransferSpreadsheet instead.

Enter
TransferSpreadsheet
in a code module, highlight it, and press F1.


Feb 13 '07 #6

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

Similar topics

0
by: AHIhelp | last post by:
I have a .Net report that has several parameters that go into it. When the report is run and I try to right-click and use the built in Export to Excel function in IE 6 - it opens up excel and...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
8
by: DC Gringo | last post by:
I have a simple button that should open another window and export a datagrid to an Excel file. I'm getting: "Name 'window' is not declared." What do I need to declare or import? <INPUT...
13
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
1
by: JawzX01 | last post by:
Hello All, First, thank you for any help you can provide. I'm trying to do a simple export to excel. I've used the classic code that is all over the internet, and of course it worked without a...
3
by: yovation | last post by:
Hi, I have a 3 table database. 1 parent 1 child 1 child of child I would like to get the data into excel as 1 sheet (similar to a grouped report).
1
by: bmcgeoch | last post by:
To preface this post, I personally did not create the database in question. It was created by someone working for our technical support provider. That person has since left the company and is not...
2
by: Access user | last post by:
My apologies for crossposting this, but I did not get any response in microsoft.public.access ...
2
by: jatin32 | last post by:
Hi, I have to export query result to EXCEL file in certain location. how do I do that? I have used DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, , , , , acExportQualityScreen
4
by: Tennotrumps | last post by:
I am trying to export a report to excel but the "excel" option is greyed out. I can export the query the report is based on, but not the report. However, if I open the database on another PC I...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.