Results 1 to 15 of 15

enable/disable stuff on open/close

Threaded View

sabha enable/disable stuff on... 12-02-2014, 02:28 PM
kleptilian Re: enable/disable stuff on... 12-02-2014, 02:39 PM
sabha Re: enable/disable stuff on... 12-02-2014, 02:50 PM
kleptilian Re: enable/disable stuff on... 12-02-2014, 02:57 PM
sabha Re: enable/disable stuff on... 12-02-2014, 03:01 PM
kleptilian Re: enable/disable stuff on... 12-02-2014, 03:10 PM
sabha Re: enable/disable stuff on... 12-03-2014, 04:35 AM
sabha Re: enable/disable stuff on... 12-03-2014, 11:32 AM
kleptilian Re: enable/disable stuff on... 12-03-2014, 11:50 AM
sabha Re: enable/disable stuff on... 12-03-2014, 02:22 PM
sabha Re: enable/disable stuff on... 12-10-2014, 03:39 AM
kleptilian Re: enable/disable stuff on... 12-15-2014, 11:02 AM
sabha Re: enable/disable stuff on... 12-19-2014, 01:26 AM
junmacs Re: enable/disable stuff on... 12-19-2014, 02:24 AM
junmacs Re: enable/disable stuff on... 12-19-2014, 02:26 AM
  1. #1
    Forum Contributor
    Join Date
    11-29-2014
    Location
    India
    MS-Off Ver
    MS Excel 2007
    Posts
    240

    enable/disable stuff on open/close

    I have two subs to disable some stuff ON ALL WORKSHEETS whenever workbook opens and enable them back ON ALL WORKSHEETS when the workbook is closed. I also have a CommandButton1, by clicking on which, the workbook should be saved without any alerts and excel application should quit. Also when the user clicks on the X to quit, the workbook should get saved without alerts.

    Iam confused whether I should write this in ThisWorkbook or all Sheet modules.
    Also which method is correct to call a sub: CALL, RUN or just write the name of the sub?
    Will this affect any functionality of excel if the program is halted in between like computer freezing, killing the excel file or excel application process from task manager?
    Please advice.

    Sub DisableStuff()
    
            With Application
                .ScreenUpdating = False
                .WindowState = xlMaximized
                .DisplayStatusBar = False
                .DisplayFormulaBar = False
    	End With
    
    	With ActiveWidow
                ActiveWindow.DisplayHeadings = False
                ActiveWindow.DisplayWorkbookTabs = False
                ActiveWindow.DisplayHorizontalScrollBar = False
                ActiveWindow.DisplayVerticalScrollBar = False
            End With
    
    End Sub
    
    Sub EnableStuff()
    
    	With ActiveWidow
                ActiveWindow.DisplayVerticalScrollBar = True
                ActiveWindow.DisplayHorizontalScrollBar = True
                ActiveWindow.DisplayWorkbookTabs = True
                ActiveWindow.DisplayHeadings = True
            End With
    
            With Application
                .DisplayFormulaBar = True
                .DisplayStatusBar = True
                .ScreenUpdating = True
    	End With
    
    End Sub
    Last edited by sabha; 12-02-2014 at 02:37 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Disable close workbook but still force users to close thru command button
    By rathig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 07:29 AM
  2. Enable/disable copy paste (disable part not working)
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 07:23 PM
  3. open-run macro, disable marcos, close email it
    By techexpressinc2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2011, 04:19 PM
  4. disable red X but keep enable file - close working
    By Rough in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-28-2008, 06:16 PM
  5. [SOLVED] Suppress "Disable/Enable Macros" and Query Refresh dialog on open
    By Sharon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-18-2006, 05:25 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