|
Archives of the TeradataForumMessage Posted: Tue, 15 Feb 2005 @ 00:16:39 GMT
I haven't run a macro, but have run queries from VBA scripts within Excel. You will probably need to create a VBA script to run the macro. In excel 2003 you can use VBA script such as: Param1 = cells (1,1) ' Get A1 value Param2 = cells (1,2) ' Get A2 value Then run your query (search the VBA help using openDatabase and or RecordSet for some examples of how you might do this). Then in a loop read through the data one record at a time and place them into the spreadsheet. Eg: With recordSet row = 10 ' Start in row 10 Do While Not .EOF ' assumes query returns a column called "firstColumn" ' put the value in the first column of the current row Cells (row, 1) = !firstColumn ' assumes query has a column called "col2" ' put the value in the second column of the current row Cells (row, 2) = !col2 'etcetera .MoveNext row = row + 1 ' point to the next row in the spreadsheet. Loop End With Hope this is of some help Glenn Mc
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||