Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a simple way of performing your task.
1) Create a .BAT file with the following line MyBat.Bat excel.exe "c:\My Folder\book1.xls This will open the workbook book1.xls 2) Create a workbook open event in the book1.xls Which will read a text file ReadFile.Txt using the text lines read open another workbook and insert the data ReadFile.txt C:\Sales reports\salesrep.xls 129290 Sheet1 C35 Private Sub Workbook_Open() Const ForReading = 1, ForWriting = 2, _ ForAppending = 3 Const TextFile = "c:\temp\Readfile.Txt" Set fs = CreateObject("Scripting.FileSystemObject") Set fin = fs.OpenTextFile(TextFile, _ ForReading, TristateFalse) BookName = fin.readline WriteData = fin.readline SheetName = fin.readline WriteRange = fin.readline fin.Close Set WriteBk = Workbooks.Open(Filename:=BookName) With WriteBk.Sheets(SheetName) .Range(WriteRange) = WriteData End With WriteBk.Close savechanges:=True Application.Quit End Sub "Satish S. Joshi" wrote: Hello, I need a command line utility that can insert data into an Excel spreadsheet from command prompt. The syntax could be something like - insertintoxls.exe "C:\Sales reports\salesrep.xls" "129290" "Sheet1!C35" where - insertintoxls.exe is the utility itself. - "C:\Sales reports\salesrep.xls" is the complete path for the Excel spreadsheet. - 129290 is the value to be inserted. - Sheet1!C35 is the cell reference. In this example, the utility should open file salesrep.xls and insert value 129290 into cell C35 on sheet 1. Any help in this reagard would be greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting data into Word document by a range of dates from Excel spreadsheet | New Users to Excel | |||
I want to select every 10th line of data in an excel spreadsheet? | Excel Discussion (Misc queries) | |||
inserting a line between different data | Excel Discussion (Misc queries) | |||
Looking for a Utility with Multi Line REM conversion | Excel Programming | |||
Inserting a new line in spreadsheet | Excel Discussion (Misc queries) |