Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.scripting.vbscript,microsoft.public.dotnet.languages.vb,microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.scripting.vbscript,microsoft.public.dotnet.languages.vb,microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need sample for reading value from and writing value to cell E53 from outside Excel | Excel Discussion (Misc queries) | |||
Writing and reading from a template Excel file using ADO.Net - results not recalculated | Excel Programming | |||
question about Excel file writing and reading | Excel Programming | |||
Reading data from an excel sheet and writing to another | Excel Programming | |||
Reading and writing from/into several worksheets | Excel Programming |