G
Guest
Hello all, thanks in advance for any help you can provide.
I want export the results of a query to a specific location in a spreadsheet
by using a range name in the spreadsheet.
For example I want to copy the results of query "Financial Categories" to
the file "C:\test.xls" at the pre-defined range "FinancialCategoriesStart" in
the spreadsheet.
I do not want to link to the Excel file to the Access DB, I need this to be
pushed out from Access.
Apparently TransferSpreadsheet cannot do this?
I do know how to open the file as an Excel Object in Access VBA code, but
unsure of what to do from there. Is there anyway I can replicate something
as simple as copying the results of the query and pasting to a certain range
name.
Here's the psuedocode of what I want accomplish, any ideas how to make
something like this work?
Sub testtransfer()
Dim Survey As Object
Dim MyFilename As String
Set Survey = CreateObject("Excel.Application")
Survey.Workbooks.Open Filename:="C:\test.xls"
CurrentDb.Recordsets("Financial Categories").Copy
Survey.ActiveWorkbook.Sheets("Feeder").Activate
Survey.ActiveWorkbook.Sheets("Feeder").Range("FinancialCategoriesStart").Activate
Survey.ActiveCell.Paste
MyFilename = Survey.ActiveWorkbook.FullName
Survey.ActiveWorkbook.Save
Survey.Quit
End Sub
I want export the results of a query to a specific location in a spreadsheet
by using a range name in the spreadsheet.
For example I want to copy the results of query "Financial Categories" to
the file "C:\test.xls" at the pre-defined range "FinancialCategoriesStart" in
the spreadsheet.
I do not want to link to the Excel file to the Access DB, I need this to be
pushed out from Access.
Apparently TransferSpreadsheet cannot do this?
I do know how to open the file as an Excel Object in Access VBA code, but
unsure of what to do from there. Is there anyway I can replicate something
as simple as copying the results of the query and pasting to a certain range
name.
Here's the psuedocode of what I want accomplish, any ideas how to make
something like this work?
Sub testtransfer()
Dim Survey As Object
Dim MyFilename As String
Set Survey = CreateObject("Excel.Application")
Survey.Workbooks.Open Filename:="C:\test.xls"
CurrentDb.Recordsets("Financial Categories").Copy
Survey.ActiveWorkbook.Sheets("Feeder").Activate
Survey.ActiveWorkbook.Sheets("Feeder").Range("FinancialCategoriesStart").Activate
Survey.ActiveCell.Paste
MyFilename = Survey.ActiveWorkbook.FullName
Survey.ActiveWorkbook.Save
Survey.Quit
End Sub