Results 1 to 6 of 6

Thread: Disabling all menus

  1. #1

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    I was wondering if there was code to disable all of the menu items on a form, instead of having to go through each one and setting them to disabled manually.

    Thanks

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ..disbale all menus


    '
    Option Explicit
    '
    Public Sub MenuDis()
    '
    'mycontrol = control and increment is increment for forms
    'some situtations use more than one form.
    '
    Dim ctlMyControl As Control
    Dim intIncrement As Integer
    '
    For intIncrement = 0 To Forms.Count - 1
    For Each ctlMyControl In Forms(intIncrement).Controls
    '
    If TypeOf ctlMyControl Is Menu Then
    '
    ctlMyControl.Enabled = False
    '
    End If
    '
    Next ctlMyControl
    '
    Next intIncrement
    '
    End Sub
    '
    '========================================================================
    '========================================================================
    Private Sub Command1_Click()
    Call MenuDis

    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest
    You can use a For Each Loop. Make a CommandButton and put the Following code in it. This code will Loop through all of the Objects on the Form and if there is a Menu, it will be disabled.

    Code:
    Dim Obj As Object
    
    ' Loop through all controls
    For Each Obj In Controls
        
        ' If the object is a Menu then disable it
        If TypeOf Obj Is Menu Then
            Obj.Enabled = False
        End If
    
    Next Obj

  4. #4
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    I have'nt found anything easy yet. I wrote 2 subs. 1 called DisableMnuItems and 1 called EnableMnuItems and just made a call to these subs whenever. Manually sux!

    ..later

  5. #5

    Thread Starter
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Thanks everybody I got it working.

  6. #6
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    Here is a question for you Megatron. How would you dim or disable foreign application menus?


    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width