Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Running an Excel Macro from an Access Command Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Kennedy - 05 Jul 2007 10:37 GMT
Hi ,

Can anyone help me with this, I am trying to run an excel macro from an
access command button.
I want the macro to Bold the Headings on a excel spreadsheet.
The code runs without any errors but the macro doesnt seem to work, I think
I have got the line
ExcelApp.ExecuteExcel4Macro "RUN(""PERSONAL.XLS!BoldHead"")"   wrong

The code:

Private Sub cmdRunMac_Click()

Dim ExcelApp As Excel.Application
Dim ExcelBook As Excel.Workbook

Set ExcelApp = Excel.Application
ExcelApp.Visible = True
Set ExcelBook = ExcelApp.Workbooks.Open("C:\Documents and
Settings\emilie.vieville\Desktop\head.xls")

ExcelApp.ExecuteExcel4Macro "RUN(""PERSONAL.XLS!BoldHead"")"

ExcelBook.Save

ExcelApp.Quit
Set ExcelBook = Nothing
Set ExcelApp = Nothing

End Sub

Any help would be greatly appreciated

Thanks,
David K
Dennis - 05 Jul 2007 19:20 GMT
Silly question, but if you have code that works, WHY do you need to execute a
macro?

> Hi ,
>
[quoted text clipped - 31 lines]
> Thanks,
> David K
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.