Exporting to Excel question

pdbowling

Registered User.
Local time
Today, 10:11
Joined
Feb 14, 2003
Messages
179
Hi,
When exporting a query to Excel, it's easy to just send it to a spreadsheet, but can it be directed to a particular cell??
If not, can anyone tell me how to set up a module to do it?
Thank you all so much.
PB
 
addendum

I was refering to using a macro above. Sorry.
PB
 
You might try nameing the cells, or selecting and nameing the range of cells in the spreadsheet. Then attempt to send the data to them by useing the proper path such as DOCNAME.WORKSHEET.RANGENAME
I havent tried this yet, but I will work on it.
 
Hi,
I haven't tried it with a macro but below is the code that I have used to export data to an Excel sheet. Play with it so that you get the dessired results.

'********************************
'Start of code tells Access to create a new Excell workbook
Set ExcelApp = CreateObject("Excel.Application")

'With the new workbook do the following
With ExcelApp
.workbooks.Open strFileToOpen 'File to open
.Visible = True 'Can be set to false if you dont want to see Excel do its thing
.range("C2").Select 'which cell to select
.Activecell = Me.txtGCAS 'assing the value of the txtGCAS field to the selected cell

'Save the results.
.ActiveWorkbook.SaveAs FileName:=strFilePathName 'save the file, path/file name

'Print file
.ActiveSheet.PrintOut 'if you want to print the sheet

'Close and quit
.ActiveWindow.Close
End With
ExcelApp.Quit
Set ExcelApp = Nothing

'********************************
Remember to declare your variables and change field names accordingly.

Regards,
George
 

Users who are viewing this thread

Back
Top Bottom