D
DizzyD
Hello all,
I currently have a vb script that runs and reads all
files in a folder and then shows the file name and the
last line of each file (it has the totals) in a msg box
for each file. Something like ; ABC-12324 = Total# 97 . I
would like alter the script to push the MsgBox info to a
new spreadsheet.
************************************************
Partial script:
*************************
Public Function GetData()
Set Sh = CreateObject("WScript.Shell")
mstrPath = Sh.CurrentDirectory
Set Sh = Nothing
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder(mstrPath)
Set Files = Folder.Files
If Files.Count <> 0 Then
For Each File In Files
If LCase(Trim(Right(File.Name,3))) = mstrExtension
Then
Set objFile = FSO.OpenTextFile(File, 1)
strLine = ""
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Loop
objFile.Close
MsgBox File.Name & " = " & strLine
'Load Excel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
x = 1
strComputer = "."
*********************************************
With this I get the MsgBox and the spreadsheet opens but
that's it. No data gets to Excel.
What am I missing???
Thanks,
I currently have a vb script that runs and reads all
files in a folder and then shows the file name and the
last line of each file (it has the totals) in a msg box
for each file. Something like ; ABC-12324 = Total# 97 . I
would like alter the script to push the MsgBox info to a
new spreadsheet.
************************************************
Partial script:
*************************
Public Function GetData()
Set Sh = CreateObject("WScript.Shell")
mstrPath = Sh.CurrentDirectory
Set Sh = Nothing
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder(mstrPath)
Set Files = Folder.Files
If Files.Count <> 0 Then
For Each File In Files
If LCase(Trim(Right(File.Name,3))) = mstrExtension
Then
Set objFile = FSO.OpenTextFile(File, 1)
strLine = ""
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Loop
objFile.Close
MsgBox File.Name & " = " & strLine
'Load Excel
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
x = 1
strComputer = "."
*********************************************
With this I get the MsgBox and the spreadsheet opens but
that's it. No data gets to Excel.
What am I missing???
Thanks,