Writing data to an existing excel spreadsheet

  • Thread starter Thread starter TAMMY
  • Start date Start date
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"
 
If you don't open the file, how do you think the code will know where to put
the data?
 
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
 
...
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.

--
 
Back
Top