+ Reply to Thread
Results 1 to 3 of 3

Problem with ThisWorkbook Module: Two Private Sub Workbook_Open()

  1. #1
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Problem with ThisWorkbook Module: Two Private Sub Workbook_Open()

    Hi,

    It seem like have two Private Sub Workbook_Open() in the ThisWorkbook Module make both code not working.
    I tried to put them both under one Private but not working also. One of the Private has Option Explicit.

    Here is the code:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Is there a solution to this?

    Thanks

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Problem with ThisWorkbook Module: Two Private Sub Workbook_Open()

    Good afternoon DavidRoger

    You can only have one Workbook_Open module per file - the same goies for any other event procedure (or any normal module with identical names, really).
    The solution is just to merge the two instructions into one file, and they will be executed consecutively, thus :
    Please Login or Register  to view this content.
    HTH

    DominicB

  3. #3
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    184

    Re: Problem with ThisWorkbook Module: Two Private Sub Workbook_Open()

    Thanks. It works. No sure why it didn't work before.

+ 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. [SOLVED] Private Sub Workbook_Open Event Problem
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-30-2015, 01:30 PM
  2. Private sub workbook_open code running workbook_open code from other project
    By marshall_massive in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2013, 06:07 PM
  3. Replies: 1
    Last Post: 08-30-2011, 02:23 AM
  4. Problem with ThisWorkbook Module
    By docnadir in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2011, 12:02 PM
  5. [SOLVED] Calls from sheet module to ThisWorkbook module
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-23-2005, 11:05 AM

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