|
Answer» It is solved!!! You can use run a SUB at Workbook Open time, to read the text file and get the text line and put it in a cell.
Code: [Select]Private Sub Workbook_Open() Dim MyString, Homedrive, Homepath, Filename, Fullname Homedrive = Environ("HOMEDRIVE") Homepath = Environ("HOMEPATH") Filename = "Excel-value.txt" Fullname = Homedrive & Homepath & "\" & Filename Open Fullname For INPUT As #1 Input #1, MyString Close #1 [A1] = MyString End Sub
Here is a batch file to TEST it
Code: [Select]@echo off echo Send string to Excel set folder=%HOMEDRIVE%%HOMEPATH% set filename=Excel-value.txt echo Folder: %folder% echo File: %filename% set /p mystring="Enter string to IMPORT into Excel ? " echo. echo %mystring% > "%folder%\%filename%" echo Contents of file: type "%folder%\%filename%" echo. echo READY to start Excel pause echo. start /WAIT "" "S:\Test\Excel\Environ004.xls" echo. echo Excel finished pause And a picture
|