Forum Discussion
syedsafvan
15 years agoContributor
Hello Kent,
I too think that we don't have enough with DDT to write out stuff into spreadsheets. So for this purpose I used COM. Write your own custom COM functions that will help you get your job done. In my case I wanted to write stuff into the spread sheet and browse the spread sheet a lot so did not want to use the "next" method of DDT that accessed cells sequentially. So the COM functions appeared to be the best solution for me.
Script below in VB
Dim objExcel
Dim objWorkbook
Function DataSheet_GetAccess(WorkBookName)
Dim FilePath
FilePath = ProjectSuite.Path & "TestData\" & WorkBookName
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists (FilePath) then
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(FilePath)
DataSheet_GetAccess = 1
Else
DataSheet_GetAccess = 0
End if
End Function
Sub DataSheet_SetData(WorkSheetName, IterationNumber, FieldName, Value)
Set objWorksheet = objWorkbook.Worksheets(WorkSheetName)
i = 1
Do While objWorksheet.Cells(1, i).Value <> ""
If objWorksheet.Cells(1, i).Value = FieldName Then
objWorksheet.Cells(IterationNumber, i).Value = Value
Exit Do
End If
i = i + 1
Loop
Set objWorksheet = Nothing
End Sub
You might write your own stuff.
As far as writing into csv file that is very simple you could just use the built in aqFile. Look into help for aqFile.WriteToTextFile()
Thank you
Syed
Related Content
Recent Discussions
- 11 hours agodhundley