Howdy-

I've built some scripts using the FileSystemObject &
CreateTextFile/ReadAll/WriteLine methods that take the contents of local
logfiles (vendor-produced) and write them to another text file in a UNC
path using schtasks.

Now, the user wants the output to be in an excel spreadsheet...

I don't think changing the format to .csv is going to work; the original
logfiles vary between lines with five columns of data and lines with
seven or none at all... Can I do this within the FSO or do I need to
figure out how to use Excel.Application?


Thanks,
BM

Re: write data to Excel spreadsheet? by NY

NY
Mon Dec 11 14:44:21 CST 2006

Excel object is the only way, and its quite easy.
google vbscript+excel

"Brian MXP" <brian@nospam.broad.mit.edu> wrote in message
news:%23$VJlJWHHHA.3688@TK2MSFTNGP03.phx.gbl...
> Howdy-
>
> I've built some scripts using the FileSystemObject &
> CreateTextFile/ReadAll/WriteLine methods that take the contents of local
> logfiles (vendor-produced) and write them to another text file in a UNC
> path using schtasks.
>
> Now, the user wants the output to be in an excel spreadsheet...
>
> I don't think changing the format to .csv is going to work; the original
> logfiles vary between lines with five columns of data and lines with seven
> or none at all... Can I do this within the FSO or do I need to figure out
> how to use Excel.Application?
>
>
> Thanks,
> BM



Re: write data to Excel spreadsheet? by Richard

Richard
Mon Dec 11 14:50:01 CST 2006

I have a sample VBScript program demonstrating how to write values to an
Excel spreadsheet linked here:

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

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"NY Steve" <j@j.j> wrote in message
news:OTzDkUWHHHA.1264@TK2MSFTNGP03.phx.gbl...
> Excel object is the only way, and its quite easy.
> google vbscript+excel
>
> "Brian MXP" <brian@nospam.broad.mit.edu> wrote in message
> news:%23$VJlJWHHHA.3688@TK2MSFTNGP03.phx.gbl...
>> Howdy-
>>
>> I've built some scripts using the FileSystemObject &
>> CreateTextFile/ReadAll/WriteLine methods that take the contents of local
>> logfiles (vendor-produced) and write them to another text file in a UNC
>> path using schtasks.
>>
>> Now, the user wants the output to be in an excel spreadsheet...
>>
>> I don't think changing the format to .csv is going to work; the original
>> logfiles vary between lines with five columns of data and lines with
>> seven or none at all... Can I do this within the FSO or do I need to
>> figure out how to use Excel.Application?
>>
>>
>> Thanks,
>> BM
>
>



Re: write data to Excel spreadsheet? by mr_unreliable

mr_unreliable
Mon Dec 11 17:25:04 CST 2006

This is a multi-part message in MIME format.
--------------000504040004080307010900
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

hi Brian,

Attached is a script by microsoft, showing how to write
stuff into an excel spreadsheet.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)




--------------000504040004080307010900
Content-Type: text/plain;
name="Excel.vbs.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Excel.vbs.txt"

' Windows Script Host Sample Script
'
' ------------------------------------------------------------------------
' Copyright (C) 1996 Microsoft Corporation
'
' You have a royalty-free right to use, modify, reproduce and distribute
' the Sample Application Files (and/or any modified version) in any way
' you find useful, provided that you agree that Microsoft has no warranty,
' obligations or liability for any Sample Application Files.
' ------------------------------------------------------------------------

' This sample will display Windows Script Host properties in Excel.

L_Welcome_MsgBox_Message_Text = "This script will display Windows Script Host properties in Excel."
L_Welcome_MsgBox_Title_Text = "Windows Script Host Sample"
Call Welcome()


' ********************************************************************************
' *
' * Excel Sample
' *
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")

objXL.Visible = TRUE

objXL.WorkBooks.Add

objXL.Columns(1).ColumnWidth = 20
objXL.Columns(2).ColumnWidth = 30
objXL.Columns(3).ColumnWidth = 40

objXL.Cells(1, 1).Value = "Property Name"
objXL.Cells(1, 2).Value = "Value"
objXL.Cells(1, 3).Value = "Description"

objXL.Range("A1:C1").Select
objXL.Selection.Font.Bold = True
objXL.Selection.Interior.ColorIndex = 1
objXL.Selection.Interior.Pattern = 1 'xlSolid
objXL.Selection.Font.ColorIndex = 2

objXL.Columns("B:B").Select
objXL.Selection.HorizontalAlignment = &hFFFFEFDD ' xlLeft

Dim intIndex
intIndex = 2

Sub Show(strName, strValue, strDesc)
objXL.Cells(intIndex, 1).Value = strName
objXL.Cells(intIndex, 2).Value = strValue
objXL.Cells(intIndex, 3).Value = strDesc
intIndex = intIndex + 1
objXL.Cells(intIndex, 1).Select
End Sub

'
' Show WScript properties
'
Call Show("Name", WScript.Name, "Application Friendly Name")
Call Show("Version", WScript.Version, "Application Version")
Call Show("FullName", WScript.FullName, "Application Context: Fully Qualified Name")
Call Show("Path", WScript.Path, "Application Context: Path Only")
Call Show("Interactive", WScript.Interactive, "State of Interactive Mode")


'
' Show command line arguments.
'
Dim colArgs
Set colArgs = WScript.Arguments
Call Show("Arguments.Count", colArgs.Count, "Number of command line arguments")

For i = 0 to colArgs.Count - 1
objXL.Cells(intIndex, 1).Value = "Arguments(" & i & ")"
objXL.Cells(intIndex, 2).Value = colArgs(i)
intIndex = intIndex + 1
objXL.Cells(intIndex, 1).Select
Next



' ********************************************************************************
' *
' * Welcome
' *
Sub Welcome()
Dim intDoIt

intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
vbOKCancel + vbInformation, _
L_Welcome_MsgBox_Title_Text )
If intDoIt = vbCancel Then
WScript.Quit
End If
End Sub


--------------000504040004080307010900--