+ Reply to Thread
Results 1 to 4 of 4

Arrary with Findcontrol

Hybrid View

  1. #1
    Moody
    Guest

    Arrary with Findcontrol

    Hi,
    I have used the following code to disable all menu bar items except File and
    Help. Is there a simpler way of writing this code. My code works but I am
    just curious.

    Any help is appreciated.

    Regards
    Moody

  2. #2
    Moody
    Guest

    RE: Array with Findcontrol

    sorry forgot to add my code:
    With Application.CommandBars("Worksheet Menu Bar")
    .FindControl(ID:=30003).Enabled = False
    .FindControl(ID:=30004).Enabled = False
    .FindControl(ID:=30005).Enabled = False
    .FindControl(ID:=30006).Enabled = False
    .FindControl(ID:=30007).Enabled = False
    .FindControl(ID:=30011).Enabled = False
    .FindControl(ID:=30009).Enabled = False
    .FindControl(ID:=3, Recursive:=True).Enabled = False
    .FindControl(ID:=748, Recursive:=True).Enabled = False
    .FindControl(ID:=3823, Recursive:=True).Enabled = False
    .FindControl(ID:=846, Recursive:=True).Enabled = False
    End With


    > Hi,
    > I have used the following code to disable all menu bar items except File and
    > Help. Is there a simpler way of writing this code. My code works but I am
    > just curious.
    >
    > Any help is appreciated.
    >
    > Regards
    > Moody


  3. #3
    Doug Glancy
    Guest

    Re: Array with Findcontrol

    Moody,

    Here's a start:

    Sub test()

    Dim find_control_array
    Dim find_control

    With Application.CommandBars("Worksheet Menu Bar")
    find_control_array = Array(30003, 30004) ' add the rest
    For Each find_control In find_control_array
    .FindControl(ID:=find_control).Enabled = False
    Next find_control
    'another loop here with the recursive argument
    End With


    End Sub

    hth,

    Doug Glancy

    "Moody" <Moody@discussions.microsoft.com> wrote in message
    news:1159A0F0-C950-466F-94C4-5EC773C7E772@microsoft.com...
    > sorry forgot to add my code:
    > With Application.CommandBars("Worksheet Menu Bar")
    > .FindControl(ID:=30003).Enabled = False
    > .FindControl(ID:=30004).Enabled = False
    > .FindControl(ID:=30005).Enabled = False
    > .FindControl(ID:=30006).Enabled = False
    > .FindControl(ID:=30007).Enabled = False
    > .FindControl(ID:=30011).Enabled = False
    > .FindControl(ID:=30009).Enabled = False
    > .FindControl(ID:=3, Recursive:=True).Enabled = False
    > .FindControl(ID:=748, Recursive:=True).Enabled = False
    > .FindControl(ID:=3823, Recursive:=True).Enabled = False
    > .FindControl(ID:=846, Recursive:=True).Enabled = False
    > End With
    >
    >
    > > Hi,
    > > I have used the following code to disable all menu bar items except File

    and
    > > Help. Is there a simpler way of writing this code. My code works but I

    am
    > > just curious.
    > >
    > > Any help is appreciated.
    > >
    > > Regards
    > > Moody




  4. #4
    Moody
    Guest

    Re: Array with Findcontrol

    I tried and it works. Thanks a lot Doug, I appreciate your help.

    "Doug Glancy" wrote:

    > Moody,
    >
    > Here's a start:
    >
    > Sub test()
    >
    > Dim find_control_array
    > Dim find_control
    >
    > With Application.CommandBars("Worksheet Menu Bar")
    > find_control_array = Array(30003, 30004) ' add the rest
    > For Each find_control In find_control_array
    > .FindControl(ID:=find_control).Enabled = False
    > Next find_control
    > 'another loop here with the recursive argument
    > End With
    >
    >
    > End Sub
    >
    > hth,
    >
    > Doug Glancy
    >
    > "Moody" <Moody@discussions.microsoft.com> wrote in message
    > news:1159A0F0-C950-466F-94C4-5EC773C7E772@microsoft.com...
    > > sorry forgot to add my code:
    > > With Application.CommandBars("Worksheet Menu Bar")
    > > .FindControl(ID:=30003).Enabled = False
    > > .FindControl(ID:=30004).Enabled = False
    > > .FindControl(ID:=30005).Enabled = False
    > > .FindControl(ID:=30006).Enabled = False
    > > .FindControl(ID:=30007).Enabled = False
    > > .FindControl(ID:=30011).Enabled = False
    > > .FindControl(ID:=30009).Enabled = False
    > > .FindControl(ID:=3, Recursive:=True).Enabled = False
    > > .FindControl(ID:=748, Recursive:=True).Enabled = False
    > > .FindControl(ID:=3823, Recursive:=True).Enabled = False
    > > .FindControl(ID:=846, Recursive:=True).Enabled = False
    > > End With
    > >
    > >
    > > > Hi,
    > > > I have used the following code to disable all menu bar items except File

    > and
    > > > Help. Is there a simpler way of writing this code. My code works but I

    > am
    > > > just curious.
    > > >
    > > > Any help is appreciated.
    > > >
    > > > Regards
    > > > Moody

    >
    >
    >


+ 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