+ Reply to Thread
Results 1 to 8 of 8

Calling Subroutine from Module

  1. #1
    Registered User
    Join Date
    11-27-2013
    Location
    Boston, Mass
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Calling Subroutine from Module

    I am a VBA newbie, and have leveraged the knowledge base here to bootstrap my coding. I have run into a strange problem that I am hoping one of the experts can help.

    For compatibility with an Add-in that I have, 90% of my program is in Module4, while one subroutine is in Sheet1.
    I have a line in my Module4 program

    Call Sheets(1).Matrix_program(1)

    In two different Laptops one running Excel 2010 and one running Excel 2013 - I have no problems.

    In two other Laptops (running Excel 2013) I get the following error
    Run-time error '32809':
    Application defined or object-defined error

    I have reinstalled Excel as well as the Add-In. No luck. It just seems that in these two Laptops, something is preventing calling a subroutine in Sheet1 from a Module.
    I have looked through the Security settings, but do not see any difference.
    Any suggestion would be welcome.

    Thanks

    - indra

    In the problem

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calling Subroutine from Module

    Are you sure that the problem isn't with the Matrix_program subroutine itself?

  3. #3
    Registered User
    Join Date
    11-27-2013
    Location
    Boston, Mass
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Calling Subroutine from Module

    I have exhausted that line of thought before I posted. If the problem were in the Matrix_program, it should have failed in all the Laptops. The fact that it runs in two Laptops, and doesn't in the other two has me stumped.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calling Subroutine from Module

    Why not post the code there? There are some changes the user can make to their Excel that could make the code fail, assumptions about the default number of sheets etc. If you post the code we can take a look, there is no way of setting this:
    something is preventing calling a subroutine in Sheet1 from a Module
    So the issue must lay elsewhere

  5. #5
    Registered User
    Join Date
    11-27-2013
    Location
    Boston, Mass
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Calling Subroutine from Module

    I removed the entire matrix program, and replaced it with
    Public Sub Matrix_program
    msgbox ("got here")
    End Sub

    I still get the same error message.

    Interestingly, when I run a simple test macro in the same pc of calling a small program from Module4 to Sheet1, it runs fine.
    Is there a size restriction that could be triggering this behavior ?

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calling Subroutine from Module

    The only way we'll be able to tell us what's causing it is if you upload a sample file that exhibits the same behaviour - without that it's just guessing I'm afraid

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Calling Subroutine from Module

    Or post all your code

  8. #8
    Registered User
    Join Date
    11-27-2013
    Location
    Boston, Mass
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Calling Subroutine from Module

    After a lot of experimentation, I was able to have a work aroun. The total size of the excel program was about 10MB. I ended up deleting a bunch of forms - with embedded BMPs as the background picture for an on-line help feature. Deleting these reduced the size of the program to 7MB. I now don't have the issue on the two problem PCs.

    I don't quite understand why the problem was resolved, and why deleting the forms solved the issue on a PC with 4GB of RAM.

+ 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. Calling a Variable Subroutine
    By WayneFontes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-27-2007, 03:47 PM
  2. Calling a Subroutine (2)
    By Configurator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-23-2007, 06:52 PM
  3. HELP! Calling subroutine in different workbook
    By ChrisWalker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-01-2006, 07:32 AM
  4. [SOLVED] Calling a subroutine in a loop
    By Jeff@DE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-09-2006, 06:00 AM
  5. Calling a subroutine in another workbook
    By mta37 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2005, 12:23 AM

Tags for this Thread

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