Results 1 to 5 of 5

Thread: [RESOLVED] [VBA in Access and Excel] Two modules with same name

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    42

    Resolved [RESOLVED] [VBA in Access and Excel] Two modules with same name

    I'm working on improving some VBA code in Excel, but the only time it's ever run is during the process of a huge macro in Access (the macro opens the Excel file and runs the macro in Excel and the Access macro does a bunch of stuff before and after). In Access, we have the following code:

    Code:
    Set ObjXLApp = CreateObject("excel.application")
    Set objXLBook = ObjXLApp.workbooks.Open("whatever.xls")
    ObjXLApp.Visible = True
    ObjXLApp.Run ("SomeMacro")
    ObjXLApp.Quit
    My question is, which version of SomeMacro is run if the Excel workbook has two different modules with this name? They do basically the same thing, but I just want to know which one I can delete out. One is in the code for a worksheet, one is in a module, so my guess is the one in the module is the one that is run. Am I right? Thanks for any help!

    Oh, similar question. In the Access file, there are three modules each with a function: Public Function getPath() As String
    Which one is run when it's called? It is called only in the three modules that it is in. So, does it default to using the one in the same module? The code is all exactly the same, so again, not real important, but I'm trying to clean things up a bit.
    Last edited by ActSciMan; Aug 9th, 2011 at 03:51 PM. Reason: missing "

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width