+ Reply to Thread
Results 1 to 14 of 14

One workbook affects all workbooks

Hybrid View

  1. #1
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Question One workbook affects all workbooks

    I have made a workbook file which is a form. I deleted all tool bars except "Print" and "save as". And I have saved this workbook. When I startup XL again to do other work It brings up my same bar arangement as my form. When I change it back it also changes my form file. How do I keep my form arrangement seperate from the standerd excel set up?
    Last edited by amsanborn; 11-24-2009 at 01:39 PM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook effects all workbooks

    Hi,

    some settings, like visible tool bars, etc. are Excel application specific. Other settings are tied to the workbook. Unfortunately, it is not immediately apparent which settings affect only the current file and which do not.

    You would probably need a macro that runs when your form workbook is opened, hides the unwanted toolbars, and another macro that runs before the workbook is closed and restores them again.

    This can be achieved by creating two macros in the ThisWorkbook module. Hit Alt-F11, double click ThisWorkbook and enter this code:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
       <your taskbar show again code>
    End Sub
    
    Private Sub Workbook_Open()
        <your taskbar hide code>
    End Sub
    To find out what the code is to show and hide your specific taskbars and icons, you can do this:
    With the normal toolbars showing, start the macro recorder
    hide all the toolbars you want to hide
    stop the macro recorder

    Then, start the macro recorder again
    restore all the toolbars back to normal
    stop the macro recorder

    Now you have a new code module with the two macros, showing lines similar to these:

        
        Application.CommandBars("Formula Auditing").Visible = True
        Application.CommandBars("Task Pane").Visible = True
    for showing toolbars

    or

        Application.CommandBars("Task Pane").Visible = False
        Application.CommandBars("Formula Auditing").Visible = False
    for hiding toolbars and screen elements

    Copy and paste these commands into your Workbook_Open and Workbook_BeforeClose routines.

    hth
    Last edited by teylyn; 11-20-2009 at 03:22 PM.

  3. #3
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook effects all workbooks

    Thanks I will try tomake this work I will let you Know. Also I lived in Rotorua for a year, had a great time.

  4. #4
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook effects all workbooks

    This is what I have in code. But doesnt work what did I do wrong?

    Private Sub workbook_open()
    
    End Sub
        Application.CommandBars("Standard").Visible = True
        Application.CommandBars("Formatting").Visible = True
        Application.DisplayStatusBar = True
        Application.CommandBars("Drawing").Visible = True
        End Sub
    
    
    
    
    
    Private Sub workbook_beforeclose(cancel As Boolean)
        Application.CommandBars("Standard").Visible = False
        Application.CommandBars("Formatting").Visible = False
        Application.CommandBars("Drawing").Visible = False
        Application.CommandBars("Forms").Visible = False
    End Sub
    Last edited by teylyn; 01-20-2010 at 04:28 PM.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook effects all workbooks

    Also I lived in Rotorua for a year, had a great time
    pooh, the smell! Couldn't live there!

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook effects all workbooks

    Please use code tags when posting code. See the forum rules.

    As I understand it, you want to HIDE certain toolbars when a specific file is opened and want to restore them again when the file is closed. Your code above does the opposite. Try something like

    Option Explicit
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    
        Application.CommandBars("Standard").Visible = True
        Application.CommandBars("Formatting").Visible = True
        Application.CommandBars("Drawing").Visible = True
        Application.DisplayStatusBar = True
    End Sub
    
    Private Sub Workbook_Open()
        Application.CommandBars("Standard").Visible = False
        Application.CommandBars("Formatting").Visible = False
        Application.DisplayStatusBar = False
        Application.CommandBars("Drawing").Visible = False
    End Sub
    The code goes into the ThisWorkbook module.

  7. #7
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook effects all workbooks

    I will try it.
    Also can you help me on these questions.
    1. Abouve after _Open what is that symbol?
    2. What is the code notice when I send Code information?
    3. When you reply to a thread from me how am I suposed toanswer you the correct way?

    Thanks
    Last edited by teylyn; 01-20-2010 at 08:19 PM. Reason: removed quote

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook effects all workbooks

    Please don't quote whole posts. Use the Quick Reply box or the "New Post" button rather than the Quote button.

    1. They symbol after _Open is a pair of round brackets. Depending on your browser they may look a little funny. Just copy the whole contents of the code box and paste in your VBE.
    2. when you post code, enclose it in code tags, like this
    [code]
    your code
    [/code]
    When you use the "New Post" button you'll see the # symbol among the formatting tools. you can use it to insert code tags.
    3. I don't understand the question. Post answers in a thread when you have something to say.

  9. #9
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook effects all workbooks

    Sorry to bother you but ran into problem.
    I run my two macros (Open-Close) But when I go to the code page their not there. If I select my mscros and select (Step-Into) they go to the code page and the code pages opens. After I add your suggestion and close and then go back to read the code page the codes are gone.
    I repeat the process and instead of closing out I select Save in the code page menue.and also the save in the upper menue but the code still is not in the code page

    Smoe how I am doing somthing wrong

    Help
    AL

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook affects all workbooks

    The code should go into the ThisWorkbook module

  11. #11
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook affects all workbooks

    Thanks It works was placing in the wrong module

    I ran two other macros and this time close more menues but it did not run see attached.

    The sheet has copies of my macros look at the one with lots of delets.
    Attached Files Attached Files

  12. #12
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: One workbook affects all workbooks

    why don't you post an Excel file containing the macro(s) you want to run instead of the code in a Word doc? That'll make it much easier to analyse.

  13. #13
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook affects all workbooks

    OK thanks I will put one to gather

  14. #14
    Registered User
    Join Date
    12-19-2008
    Location
    Vancouver,WA
    MS-Off Ver
    2007 Excel
    Posts
    87

    Re: One workbook affects all workbooks

    Here is the test book
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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