+ Reply to Thread
Results 1 to 3 of 3

Anyone have a VBA code to run an Access Macro in Excel?

  1. #1
    Registered User
    Join Date
    10-25-2013
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    2

    Anyone have a VBA code to run an Access Macro in Excel?

    Was given a project at work to fix an Excel workbook that pulled info from an Access Macro. The error is a 'Run-Time Error: 7866.' This is the current code and the line with asterisks is the line the debugger highlights:

    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Dim A As Object
    Application.DisplayAlerts = False
    Set A = CreateObject("Access.Application")
    A.Visible = False
    *A.OpenCurrentDatabase ("H:\Distpatch - Broker Loads Fixed.accdb")*
    A.DoCmd.RunMacro "Summarize"
    Application.DisplayAlerts = True
    ActiveWorkbook.RefreshAll
    End Sub

    Anyone have any advice or a different code to run this macro?

    Thanks.
    Last edited by Allemang; 10-25-2013 at 09:36 AM. Reason: Error

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Anyone have a VBA code to run an Access Macro in Excel?

    I know nothing about access so could be way off but shouldn't it be .accdb not .accbd?

    Also you might need to remove the brackets from that line, you normally would use bracketed arguements when a line has an "=" in it.
    Last edited by ragulduy; 10-25-2013 at 09:33 AM.

  3. #3
    Registered User
    Join Date
    10-25-2013
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Anyone have a VBA code to run an Access Macro in Excel?

    Thanks for the reply.. sorry about the code error, I did notice that prior to posting but it didn't help... Neither did removing the brackets

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Opening Excel from Access, running Code in Excel then export back to Access
    By JungleJme in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-28-2012, 08:49 AM
  2. Running an Access macro via Excel on a shared Access db
    By koltregaskes in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2011, 10:22 AM
  3. Running excel vba code from inside access vba code
    By Lanox in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2011, 09:09 AM
  4. Replies: 0
    Last Post: 09-27-2005, 09:05 AM
  5. [SOLVED] VB Code or Excel macro to run Query/Import on Access file
    By Harry in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-22-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1