A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

exporting to excel



 
 
Thread Tools Display Modes
  #1  
Old December 19th, 2006, 10:26 PM posted to microsoft.public.access,microsoft.public.access.forms
antonov
external usenet poster
 
Posts: 31
Default 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  
Old December 20th, 2006, 12:55 AM posted to microsoft.public.access.forms,microsoft.public.access
Daniel
external usenet poster
 
Posts: 1,017
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.