+ Reply to Thread
Results 1 to 4 of 4

Can't reference ThisWorkbook from a module in another workbook module

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    Phoenix, az
    MS-Off Ver
    Excel 2013
    Posts
    26

    Can't reference ThisWorkbook from a module in another workbook module

    How can I make reference to the ThisWorkbook object in workbook 1 from the code in a module in workbook 2 in Excel 2013?

    I have 2 workbooks open and I need to delete 4 lines of code from the ThisWorkbook Object in the other workbook. The reason for this is because the 4 lines of code are in the On Deactivate event and when the other workbook gets the focus the event runs. I connot turn off events or the event in workbook 2 won't run when they are supposed to. I had hoped it I activated workbook 1 that it would reference the correct vbaproject, but it doesn't. Here's the code I tried:

    Please Login or Register  to view this content.
    I tried numerouse variations but I can only seem to delete the lines of code from the workbook that the macro is running from (workbook 2)
    I'm out of ideas! Please help

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Can't reference ThisWorkbook from a module in another workbook module

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-06-2013
    Location
    Phoenix, az
    MS-Off Ver
    Excel 2013
    Posts
    26

    Re: Can't reference ThisWorkbook from a module in another workbook module

    That worked! I'd a sworn that I had tried that.

    Thank you

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Can't reference ThisWorkbook from a module in another workbook module

    You're welcome. Thanks for the feedback.

+ 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. Compile error in hidden module: Module 1 when workbook opened on different machine!?
    By MathUKTeacher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2015, 04:38 PM
  2. copy module and past module in new workbook
    By flunzy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2013, 04:33 AM
  3. Replies: 11
    Last Post: 05-15-2012, 01:22 PM
  4. Replies: 1
    Last Post: 08-30-2011, 02:23 AM
  5. how to access Sheet module, normal module, Worbook module to type code
    By alibaba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2009, 07:51 AM
  6. Run worksheet module code from workbook module?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2005, 12:05 AM
  7. [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