+ Reply to Thread
Results 1 to 3 of 3

Declaring something higher than public to work in another workbook?

  1. #1
    Forum Contributor
    Join Date
    08-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    132

    Declaring something higher than public to work in another workbook?

    I have a workbook which contains my macros. This workbook works on other workbooks by loading them and doing things to them.

    These other workbooks are used independently from this first macro book, but they have macros built in too that are housed in ThisWorkbook, prompting the user with a MSGbox when they click "Save."

    Please Login or Register  to view this content.
    This works perfectly, however - There are two ways this can pop up:

    1. When I am using the MAIN macro book, utilizing this second book, that second book can be saved - and when it is saved, it automatically goes into ThisWorkbook and prompts whether or not I want to run these cleanup functions.
    2. I am actually using the second workbook, I click save, and get the prompt.

    I run the MAIN macro book each day, on a set of 12 sheets, so 12 times, my process is interrupted by a prompt where I just click "no." I want to bypass this, so the prompt only happens when individual users are in their respective books.

    I tried using a public boolean that gets set to "True" prior to entering the secondary workbook, but this didn't work as none of the variables I set carry over into the new workbook. Is there anything higher than Public that I can set in 1 workbook that will carry over to another workbook when it enters the ThisWorkbook section to run this save prompt?

    I hope this makes sense.......

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Declaring something higher than public to work in another workbook?

    Hi lordterrin,

    Here are a couple of approaches I have successfully taken on similar problems:
    a. If the name of the MASTER workbook is the same all the time test for ThisWorkbook.Name being the same as the MASTER name which is the same all the time.
    b. If a certain cell or cells (or sheet name) in the MASTER always has a value that is not in the other workbooks you can test for that.
    c. You can add a hidden cell to the MASTER workbook that is in a specific cell and has a known value (e.g. 'MASTER').

    I hope this helps.

    Lewis

  3. #3
    Forum Contributor
    Join Date
    08-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: Declaring something higher than public to work in another workbook?

    This is a really good idea - I can make that work!

    Thanks!

+ 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. Declaring Public Variables to create a userform
    By samz93 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-02-2013, 08:47 AM
  2. [SOLVED] declaring public array?
    By desertsp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 06:19 PM
  3. Declaring a variable as Public or Global
    By saji in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2013, 07:55 PM
  4. [SOLVED] declaring public variable value
    By Damon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2005, 10:05 AM
  5. declaring public variables
    By Loane Sharp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2005, 02: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