Writing data to an existing excel spreadsheet

T

TAMMY

I have an excel spreadsheet that that creates a chart
when the spreadsheet is opened. I am trying to pass the
chart title to a certain cell in this spreadsheet from a
form in access without having to open the excel
spreadsheet file. Does anyone know how to pass data to a
cell without opening the file?

The following code works, but I have to open the
workbook, is there any way to not open the workbook?

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open InvLevel2, , False

xlApp.Worksheets)"Qry_Inventory_Summary_Crosstab1").Range
("A10") = "Chart Title"
 
G

GVaught

If you don't open the file, how do you think the code will know where to put
the data?
 
G

Guest

You can use the TransferSpreadsheet command and it does
not open the excel file but data is sent to the file. I
am trying to avoid running the code on the open command
of the spreadsheet.

DoCmd.TransferSpreadsheet acExport
 
J

Jamie Collins

...
If you don't open the file, how do you think the code will know where to put
the data?

I don't get what you mean. The following adds text to cell A2 on
Sheet1 of my workbook without opening it:

UPDATE
[Excel 8.0;HDR=Yes;Database=C:\TotallyNew.xls].[Sheet1$A1:A2]
SET
F1='Yer tiz'
;

I think the code will know where to put the data because I specified a
cell address, although I could have specified a defined Name ('named
range').

Jamie.

--
 

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