Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Office > Excel

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-07-2009, 05:49 PM
KramerJ KramerJ is offline Windows XP Office 2003 (Version 11.0)
Novice
 
Join Date: Mar 2009
Location: Las Vegas, NV
Posts: 5
KramerJ is on a distinguished road
Default How do I call/execute an Excel macro from Access 2003

How do I call/execute an Excel macro from Access 2003. TIA
Reply With Quote
  #2  
Old 05-08-2009, 03:51 AM
Bird_FAT's Avatar
Bird_FAT Bird_FAT is offline Windows 7 Office 2007 (Version 12.0)
Super Moderator
 
Join Date: Apr 2009
Location: South East
Posts: 281
Bird_FAT is on a distinguished road
Default

Add a command button and use the following code as a starter.
(in this example, I have called the Command Button - 'MyCommandButton' - change the sections of this code to fit with the name of your button [or rename your button])

Code:
Private Sub MyCommandButton_Click()

On Error GoTo Err_MyCommandButton_Click
Dim xlsApp As Excel.Application
Dim xlswkb As Excel.Workbook
Set xlsApp = CreateObject("Excel.Application")
Set xlswkb = GetObject("*FULL_PATH_TO_FILE*")

xlsApp.Application.Run "*FILE_NAME*!*MACRO_NAME*"

xlsApp.Quit

Exit_MyCommandButton_Click:
Exit Sub

Err_MyCommandButton_Click:
MsgBox Err.Description
Resume Exit_MyCommandButton_Click

End Sub
You will, of course, need to add more code in there to do whatever else you need to do - view/print report/query, etc.

Still some work in there for you, but This should give you the start you need
__________________

Bird

If my post has helped, please add to my reputation in return - Thanks!

Windows XP > Office 2003
Windows 7 > Office 2007

MASTER+

Reply With Quote
  #3  
Old 05-11-2009, 03:33 PM
KramerJ KramerJ is offline Windows XP Office 2003 (Version 11.0)
Novice
 
Join Date: Mar 2009
Location: Las Vegas, NV
Posts: 5
KramerJ is on a distinguished road
Default Excel Macro from MS Access

Bird_FAT, I being a newbie, where are the scales ?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! for using an appropriate function/Macro in Excel pawan2paw Excel 1 06-04-2009 04:28 PM
Should I uses Access or Excel? tinkertron Office 5 03-30-2009 12:30 AM
Excel or Access ? inferno Excel 1 12-06-2008 11:43 AM
Phone call through TAPI driver drdebate Outlook 0 04-09-2007 05:46 PM
Access 2003 query with wildcards into Word 2003 mail merge Poingdexter Office 1 10-30-2005 09:17 PM


All times are GMT -4. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.