Creating an Excel object

T

Terry

I have an Access application which creates an Excel workbook with data from
an Access database.
When this Excel file is created, we want to be able to add a button to the
toolbar and have it execute an Excel macro.
Is it possible to have the Access not only create the Excel document but to
add a button to the toolbar and create an Excel macro in the document?

Terry
 
R

Rob Oldfield

Yes, but I can't tell you off hand exactly how.

You'd be better off posting the question to an Excel group who'll be more
familiar with the code required.
 
M

MacDermott

If you are creating your Excel file by using TransferSpreadsheet or
OutputTo, you'll need to learn about using Automation to open an instance of
Excel and manipulate it.
If you're already using Automation, you're most of the way there.
Create a workbook with the toolbar button and macro you want. Save it
as a template. Now when you create your file in Excel, base it on that
template, and it will already have those items; you'll just add your data.
 
P

PC Datasheet

Hi Terry,

Create an Excel object named ObjExcel and add:

ObjExcel.CommandBars.Add(Name:="Custom 1").Visible = True
ObjExcel.CommandBars("Custom 1").Controls.Add Type:=msoControlButton, Id _
:=18, Before:=1

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
[email protected]
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!
 
Top