Results 1 to 2 of 2

Hide button based on USERNAME

Threaded View

  1. #1
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Hide button based on USERNAME

    Hi everybody,

    I have an activeX button on sheet "Tab". I have the following code to hide this button unless the username is ron2k_1 or cmain:
    Private Sub Workbook_Open()
    With ThisWorkbook.Sheets("Tab").CommandButton1
      Select Case Environ$("USERNAME")
        Case "ron2k_1", "cmain"
          .Shapes.CommandButton1.Visible = True
        Case Else
          .Shapes.CommandButton1.Visible = False
        End Select
      End With
    End Sub
    But it tells me that it cannot support that method. How should I do it guys?

    Thanks,
    Last edited by ron2k_1; 06-24-2011 at 03:55 PM.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

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