If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
exporting to excel
hello everybody, I know this has probably been asked many times but....
I need to export some data to a specific excel sheet situated in a specific place. I need the data to go to the next available empty line in this sheet. How can I do this? thanks again for your patience |
#2
|
|||
|
|||
exporting to excel
I googled it and came across this which I thought could help you
**** Dim lngRow As Long, lngColumn As Long Dim xlApp As Object, xlWB As Object, xlWS As Object, xlWR As Object ' next step assumes that EXCEL is not open yet Set xlApp = CreateObject("Excel.Application") Set xlWB = xlApp.Workbooks.Open "Pathtofile" Set xlWS = xlWB.Worksheets("WorksheetName") Set xlWR = xlWS.Range("FirstCellIntoWhichYou'llWrite") For lngRow = 0 To rst.RecordCount - 1 For lngColumn = 0 To rst.Fields.Count - 1 xlWR.Offset(lngRow, lngColumn).Value = rst.Fields(lngColumn - 1) Next lngColumn Next lngRow xlWB.Save Set xlWR = Nothing Set xlWS = Nothing xlWB.Close False Set xlWB = Nothing xlApp.Quit Set xlApp = Nothing -- Ken Snell **** Daniel "antonov" wrote: hello everybody, I know this has probably been asked many times but.... I need to export some data to a specific excel sheet situated in a specific place. I need the data to go to the next available empty line in this sheet. How can I do this? thanks again for your patience |
Thread Tools | |
Display Modes | |
|
|