Calling an existing Excell Spreadsheet from VBA

D

DanBair

Hi everybody:

I'm still a novice coder, but I have an Access vba application in which I'd
like to run a macro that does a query (no problem), but then opens an
existing excell spreadsheet and exports data to it (big problem). Can I do
it? Example code on the "open and export" or a place where I can get it?

Does the excell spreadsheet have to be in the same path\directory?
Does the spreadsheet come up in foreground? If it's closed will the Access
app still be running?

I hope these questions aren't too stupid, but thanks for reading them and
possibly helping.
 
F

fredg

Hi everybody:

I'm still a novice coder, but I have an Access vba application in which I'd
like to run a macro that does a query (no problem), but then opens an
existing excell spreadsheet and exports data to it (big problem). Can I do
it? Example code on the "open and export" or a place where I can get it?

Does the excell spreadsheet have to be in the same path\directory?
Does the spreadsheet come up in foreground? If it's closed will the Access
app still be running?

I hope these questions aren't too stupid, but thanks for reading them and
possibly helping.

Look up the TransferSpreadsheet method in VBA help.
The path to the spreadsheet can be any path.
The spreadsheet should be CLOSED, not open.
After you transfer the data you can open the spreadsheet using:
Application.FolowHyperlink "PathToFolder\FileName.xls"
 
D

DanBair

Awesome Fred. Thanks alot and I hope you stick around to answer some more
questions.
 

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