+ Reply to Thread
Results 1 to 2 of 2

disable save/print unless a particular cell is filled?

  1. #1
    Registered User
    Join Date
    05-12-2004
    Posts
    15

    disable save/print unless a particular cell is filled?

    I would like to force people to fill out one particular cell. I figure I can make them fill it out if they can;t save or print until this cell is filled in. Is this possible?

    THank you

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Rainxking,

    Here are 2 macros that enable or disable all menu Save and Print items. They very easy to use.

    Using the Macros:

    Enable the Menu Items
    MenuSave (True)
    MenuPrint (True)

    Disable the Menu Items
    MenuSave (False)
    MenuPrint (False)

    Macro Code:
    _________________________________________________________________

    Public Sub MenuSave(Enable As Boolean)

    '////////////////////////////////////////////////////////'
    '/
    '/ - Worksheet Menu and Standard Menu -
    '/ Enable or Disable Save and SaveAs Options
    '/
    '////////////////////////////////////////////////////////'


    'Written April 25, 2005
    'Author: Leith Ross
    'E-mail: [email protected]


    Dim Status
    Dim CmdBar1 As CommandBar
    Dim CmdBar2 As CommandBar

    Set CmdBar1 = Excel.CommandBars("Worksheet Menu Bar").Controls("File").CommandBar

    Status = Enable

    For I = 1 To CmdBar1.Controls.Count
    CtrlName = CmdBar1.Controls(I).Caption
    If CtrlName = "&Save" Or Left(CtrlName, 4) = "Save" Then
    CmdBar1.Controls(I).Enabled = Status
    End If
    Next I

    Set CmdBar2 = Excel.CommandBars("Standard")
    CmdBar2.Controls("Save").Enabled = Status

    End Sub

    _________________________________________________________________

    Public Sub MenuPrint(Enable As Boolean)

    '////////////////////////////////////////////////////////'
    '/
    '/ - Worksheet Menu and Standard Menu -
    '/ Enable or Disable Print and Print Related Options
    '/
    '/ '////////////////////////////////////////////////////////'

    'Written April 25, 2005
    'Author: Leith Ross
    'E-Mail: [email protected]


    Dim Status
    Dim CmdBar1 As CommandBar
    Dim CmdBar2 As CommandBar

    Status = Enable

    Set CmdBar1 = Excel.CommandBars("Worksheet Menu Bar").Controls("File").CommandBar
    CmdBar1.Controls("Page Set&up...").Enabled = Status
    CmdBar1.Controls("&Print...").Enabled = Status
    CmdBar1.Controls("Print Pre&view").Enabled = Status

    'Disable Print Preview Icon
    Set CmdBar2 = Excel.CommandBars("Standard")
    CmdBar2.Controls("Print Preview").Enabled = Status


    'Get Printer Icon ID since caption includes printer name
    For I = 1 To CmdBar2.Controls.Count
    Ctrl_ID = CmdBar2.Controls(I).Id
    If Ctrl_ID = 2521 Then
    CmdBar2.Controls(I).Enabled = Status
    Exit For
    End If
    Next I

    End Sub

    _________________________________________________________________

    Sincerely,
    Leith Ross

+ 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