Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.scripting.vbscript,microsoft.public.dotnet.languages.vb,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need sample for reading value from and writing value to cell E53 from outside Excel

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Need sample for reading value from and writing value to cell E53 from outside Excel

Tony wrote:

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?


For example:
=======
Option Explicit
Dim objExcel, strExcelPath, objSheet, strValue

Set objExcel = CreateObject("Excel.Application")
strExcelPath = "c:\Scripts\aaa.xls"

' Open specified spreadsheet and select worksheet.
objExcel.WorkBooks.Open strExcelPath
Set objSheet = objExcel.ActiveWorkbook.Worksheets("ws777")

' Read value from cell in row 53, column E.
strValue = objSheet.Cells(53, 5).Value
Wscript.Echo strValue

' Assign value to cell in row 53, column E.
strValue = "This is a test, this is only a test."
objSheet.Cells(53, 5).Value = strValue

' Save workbook, close, and quit Excel.
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
========
I have an example VBScript program to read values from a spreadsheet linked
he

http://www.rlmueller.net/Read%20from%20Excel.htm

And another example to write value linked he

http://www.rlmueller.net/Write%20to%20Excel.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need sample for reading value from and writing value to cell E53from outside Excel

On Jun 16, 2:48 pm, (Tony Bansten) wrote:
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


Example:

sPath = "C:\Documents and Settings\username\My Documents\Someplace\"
sExcelName = "aaa.xls"

with CreateObject("Excel.Application")
.Workbooks.Open sPath & sExcelName
.ActiveWorkbook.Worksheets("ws777").Activate
sResult = .Range("E53").Value
.Quit
end with
wsh.echo "E53 =", sResult

Tom Lavedas
===========
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need sample for reading value from and writing value to cell E53from outside Excel

On 16 Jun., 20:48, (Tony Bansten) wrote:
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


Here is a sample VBScript to write to a specific Excel Worksheet:
http://www.scriptbox.at.tt/index.php?search=Open an Excel Workbook and
write a Value to a specific Worksheet.vbs&site=1


You can find more Excel VBS Samples he
http://www.scriptbox.at.tt/index.php...h=Excel&site=1



  #6   Report Post  
Posted to microsoft.public.scripting.vbscript,microsoft.public.dotnet.languages.vb,microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Need sample for reading value from and writing value to cell E53 f

"Tony Bansten" wrote:

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


Here is a sample VBScript to write to a specific Excel Worksheet:
http://www.scriptbox.at.tt/index.php?search=Open an Excel Workbook and write
a Value to a specific Worksheet.vbs&site=1


here you can find more VBScript Samples to work with Excel
http://www.scriptbox.at.tt/index.php...h=excel&site=1



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need sample for reading value from and writing value to cell E53 from outside Excel Tony Bansten Excel Discussion (Misc queries) 1 June 17th 08 07:03 AM
Writing and reading from a template Excel file using ADO.Net - results not recalculated RJN Excel Programming 0 April 26th 06 05:39 PM
question about Excel file writing and reading Albert Ge Excel Programming 2 April 25th 05 09:12 AM
Reading data from an excel sheet and writing to another Rain Excel Programming 1 January 19th 05 09:25 AM
Reading and writing from/into several worksheets Chris Excel Programming 3 December 4th 03 08:24 PM


All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"