Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nice solution.
Never seen that before and yet it's been around for ages. Just shows how sophisticated Excel really is!! Thanks Barry "Jean-Yves" wrote: Hi Mark. Use Range("A2").copyfromrecordset reADO Regards JY "MarkS" wrote in message ... Hi, I use this code to get the data from a SQL Server database and put it into a spread sheet ' Get Geneneration Data sSql = "Select Date,hh,Dartm1,Eildon1,Eildon2 from mdff_Generation_Xtab" & _ " Where Date ='20051023' And Date < '20051030' Order By Date,hh" rsADO.Open sSql, connMelbourne, adOpenStatic, adLockReadOnly ' Copy Data rsADO.MoveFirst Counter = 2 Do Until rsADO.EOF Range("A" & Counter).Value = rsADO!Date Range("B" & Counter).Value = rsADO!hh Range("C" & Counter).Value = rsADO!Dartm1 Range("D" & Counter).Value = rsADO!Eildon1 Range("E" & Counter).Value = rsADO!Eildon2 Counter = Counter + 1 rsADO.MoveNext Loop I think there is a way of going straight to the spread sheet without going through the load the record set copy to spread sheet route. Any suggestions of a better way that does not involve so much work, there are a lot of these to do? Thanks MarkS |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving linked files from one server to anoter one | Excel Worksheet Functions | |||
Excel 2003 Error Cannot Locate the Internet Server or Proxy Server | Excel Discussion (Misc queries) | |||
Excel data to SQL Server | Excel Programming | |||
Excel VBA: moving folders on the server | Excel Programming |