Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VBA for Excel macro

Status
Not open for further replies.

clifftech

ISP
Nov 9, 2001
111
US
Advice needed...

Is it possible to write an Excel macro (vba code) within an Access Module? I am trying to open a new spreadsheet from an Access command button that will automatically insert values in certain cells of the spreadsheet. The values inserted into the spreadsheet will be determined by one of several command buttons that is clicked.

Thanks for any help.


 
You may automate an Excel.Application object in AccessVBA code.
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 

I just started working on this problem and wanted to make sure it was possible before I started reserching how it was done. Any suggestions on where I can go on-line to get information and examples on how to use Access VBA code for Excel marcos?
 
You don;t need to use Access VBA code for excel macros - you use VBA for all

In Access:

dim XLApp as Excel.Application

set XLApp = New.Excel.Application

with XLApp
'all code from here can be written as if you were in excel
end with
set XLApp = nothing

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
The Excel code I set up within Access worked great. I had to change your code to set the application object to
set XLApp = New Excel.Application.

Thanks for your help.
 
ooops - yep - no need for the .

Glad it worked for you [cheers]

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top