View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pegasus \(MVP\)[_2_] Pegasus \(MVP\)[_2_] is offline
external usenet poster
 
Posts: 1
Default Need sample for reading value from and writing value to cell E53 from outside Excel


"Tony Bansten" wrote in message
...
As fas as I heard I can write to Excel cell e.g. E53 from outside with
VBS.

How could such a code look like?

Assume I have an Excel file aaa.xls and a worksheet "ws777" inside:
How can I wread and write to this cell?

Tony

Try this:

Set objExcel = CreateObject ("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("c:\Test.xls")
Set objWorksheet = objExcel.ActiveWorkbook.Worksheets(1)
iValue = objWorksheet.Cells(1, 6).Value
objWorksheet.Cells(2, 5).Value = 55