Hello
Using SQL Server 2K.
I have a DTS package that uses a SQL task to build a result set in a global variable. This rowset is then output into a text file using an ActiveX task.
I would now like this output to go to an Excel file which I need to create on the fly so I:
Then ideally I want to:
But I get nothing in my file (I make it visible later on). I'm very new to DTS/ActiveX so it may be obvious what I am doing wrong. It might be worth noting that if I change the strRecord to a literal eg "HELP!" - it works.
TIA
mrees
Using SQL Server 2K.
I have a DTS package that uses a SQL task to build a result set in a global variable. This rowset is then output into a text file using an ActiveX task.
Code:
while not objResults.EOF
strRecord = ObjResults.GetString(2, -1, "~", "", "")
objStream.WriteLine(strRecord)
objResults.MoveNext
wend
I would now like this output to go to an Excel file which I need to create on the fly so I:
Code:
'Create Excel object
Set Xcl = CreateObject("Excel.Application")
Xcl.Visible = False
Set newBook = Xcl.Workbooks.Add
newBook.Worksheets(1).Activate
Code:
'Write to Excel file
while not objResults.EOF
strRecord = ObjResults.GetString(2, -1, "~", "", "")
newBook.Worksheets(1).Cells(2,1).value = strRecord
objResults.MoveNext
wend
TIA
mrees