Creating an Excel object

  • Thread starter Thread starter Terry
  • Start date Start date
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
 
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.
 
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.
 
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
(e-mail address removed)
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!
 
PC Datasheet said:
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.

These 1000 (if at all a real figure..) is only the result of
-- 4 years abusing the newsgroups.
-- 4 years blatantly advertising and job hunting.

You only care about making money, and you act as if the groups are your private hunting ground.
So why would ANYBODY ever trust a person like you and hire you?
********************************************************
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!

Please Steve, do contact a psychiatrist ...

Arno R
 
Back
Top