TransferSpreadsheet question

G

GD

Can I transfer (or copy) a query's results to an open Excel session without
having to save it to a file?

Failing that, is it possible to have a macro open that saved file in an open
session of Excel?

Currently, I have a macro that transfers the query results to an .xls file
on my hard drive. Then I have a RunApp that opens a new session of Excel to
open the file. But my boss says this is no good. She wants it in her open
session, or not at all.

Thanks!!!!
 
N

Noëlla Gabriël

Hi,

if you use the OutputTo command you can set the "Autostart" parameter to
True, to open the excel file automatically after creation.
If this doesn't answer your bosses question, then you can work with the
excel object model.

Dim appExcel As Excel.Application
Dim bksBooks As Excel.Workbooks
Dim wkbBook As Excel.Workbook
Dim wksSheet As Excel.Worksheet
............... complete here your declarations


'Initiate all objects and variables
Set appExcel = GetObject(, "Excel.Application")
Set bksBooks = appExcel.Workbooks
Set wkbBook = bksBooks.Open(Me.FileImp)
Set wksSheet = wkbBook.Sheets(1)
wksSheet.Activate

...................... complete here your code
 
K

Ken Snell [MVP]

Not from a macro, no, you cannot have the EXCEL file open in the current
EXCEL session. But you can do it from VBA code. Are you willing to use VBA?
 
K

Klatuu

There is another way.
That is to define a database query in Excel and run the query from there.
 
K

Klatuu

Yeah, things have been on the down side for me for a while.
I got laid off in November and, of course, didn't get to take my contact info.
If you have my home email, give me a buzz. If not, post back here.
 
K

Keith Wilby

Klatuu said:
Yeah, things have been on the down side for me for a while.
I got laid off in November

Sorry to hear that Dave, I hope things pick for you soon.

Keith.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top