Hi, Posted the question before - but could not get it going!
Can someone please Assist, as i need this to work it's part of my project!
VBscript, I'm executing a SQL command then with the result data append/add the row to an existing excel file.
Please anyone please Assist!SciptCODE
Dim objXL
Dim File_name
Option WScript
File_name="\\srv08-za063\source\test.xls"
Set objXL = WScript.CreateObject("Excel.Application")
Set wb = objXL.Workbooks.Add
Set ws = objXL.Worksheets(1)
r = 2
objXL.Visible = False
Set objConn = CreateObject( "ADODB.Connection")
Set resultSet = CreateObject ("ADODB.RecordSet")
objConn.Open fcCustom.Value(Process.Company, "Connections\FCDB")
strSQL = "select id,ProcessID from dbo.fcEventArchive where EventHistID = 2523"
resultSet.Open strSQL, objConn, 1, 2
On Error Resume Next
resultSet.MoveFirst
Do While Not resultSet.eof
ws.Cells(r, 1).Value = (resultset(0))
ws.Cells(r, 2).Value = (resultset(1))
resultSet.MoveNext
r = r + 1
Loop
resultSet.Close
objConn.Close
Set resultSet = Nothing
Set objConn = Nothing