appending to existing excel sheet?

S

scott

I am not sure which group to put this in. I chose this
because I think I have to append and I am not sure how.

I have a template in excel that has the company I work
for's logo.....It has a few other lines in there such as
account # and a few other things..

This is all in excel..the rest of the excel sheet is blank.

Is there a way to append a query or table in excel to the
bottom of this template?

I use macros that convert my queries to excel and then it
emails it to me..

Right now I am copying and pasting that into the excel
template.

I am looking for an automatic way to do this.

Thanks
Scott
 
M

[MVP] S. Clark

If you export to an existing xls file, I think it tacks it on as another
worksheet.

Anything more fancy will require using code to open, then write the data to
the exact area in the worksheet.


--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
O

onedaywhen

You can use an INSERT INTO query.

For example, if in your Excel workbook you had a worksheet called
Sheet1 and cells E3=RefID and F3=Surname (i.e. column headings) then
the following query would work:

INSERT INTO
[Sheet1$E3:F4]
IN 'C:\MyWorkbook.xls' 'EXCEL 8.0;'
SELECT
RefID, Surname
FROM MyTable

You don't have to be that precise with the cell address in the SQL
string. This would also work for the same worksheet:

INSERT INTO
[Sheet1$A1:IV65536]
IN 'C:\MyWorkbook.xls' 'EXCEL 8.0;'
SELECT
RefID, Surname
FROM MyTable
 
M

[MVP] S. Clark

Cool. Thanks for the info.
-SC
onedaywhen said:
You can use an INSERT INTO query.

For example, if in your Excel workbook you had a worksheet called
Sheet1 and cells E3=RefID and F3=Surname (i.e. column headings) then
the following query would work:

INSERT INTO
[Sheet1$E3:F4]
IN 'C:\MyWorkbook.xls' 'EXCEL 8.0;'
SELECT
RefID, Surname
FROM MyTable

You don't have to be that precise with the cell address in the SQL
string. This would also work for the same worksheet:

INSERT INTO
[Sheet1$A1:IV65536]
IN 'C:\MyWorkbook.xls' 'EXCEL 8.0;'
SELECT
RefID, Surname
FROM MyTable


"[MVP] S. Clark" <[email protected]> wrote in message
If you export to an existing xls file, I think it tacks it on as another
worksheet.

Anything more fancy will require using code to open, then write the data to
the exact area in the worksheet.


--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top