• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Button Wording Appear Base On The Access Right

cyliyu

Member
I would like to check is it possible to make the "wording" in the boxes "appear" and "disappear" based on the access right?
Or display as "NIL".
For e.g. EngrSey01 has no access to "sheetA" & "sheetB", the display will as follow:-


upload_2018-6-29_15-27-39.png
 

Attachments

  • Chandoo_AccessRightGRPS.xlsm
    54.8 KB · Views: 7
Last edited:
cyliyu
Answer is 'YES',
but why did You send file,
which don't include those already used routines?
eg which user can go/select those sheets.
 
cyliyu
Without CODE which uses those it means that someone should first make that routine before answer You question.
Now, it's like that You have car which has gasoline, but no engine!
 
This was the code to determine who has the access right based on their Login ID. It was under the module in the attached file in the first post.
Let me know if I have mistaken your question.

Code:
Sub TextBox_Click()
  Application.ScreenUpdating = False
  On Error Resume Next
  UN = Environ("username")
  If UN = Empty Then UN = Application.UserName
  yUN = WorksheetFunction.Match(UN, Sheets("GRPS").Range("C:C"), 0)
  If Err.Number = 0 Then
  shtname = ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text
  xUN = WorksheetFunction.Match(shtname, Sheets("GRPS").Range("9:9"), 0)
  If Err.Number = 0 And Sheets("GRPS").Cells(yUN, xUN) <> Empty Then
  Err.Clear
  With Worksheets(shtname)
  .Visible = xlSheetVisible
  .Activate
  .Range("A1").Select
  End With
  If Err.Number <> 0 Then MsgBox "You Selected An UnKnown Sheet!"
  Else
  msg = "Unknown Sheet!"
  If Err.Number = 0 Then msg = "You Don't Have Permit To See That Selection!"
  MsgBox msg
  End If
  Else
  MsgBox "You Are UnKnown User!"
  End If
  Application.ScreenUpdating = True
End Sub
 
Would need your help again.
There were 2 sets of code added into the spreadsheet in your attachment.
I have the following errors when added them into my master sheet.
Any advise where the errors come from?

upload_2018-6-30_10-1-53.png
upload_2018-6-30_10-2-49.png
 
cyliyu
How did You try to use that code?
If You don't know, then don't use!
It gives error, because You didn't use it correct way!
You do not need that code.
 
Thanks Vletm for your help.
The problem lies in the other code when "msg" updated accordingly but the button on the HOME sheet does not update.
Anyway, I will continue to check and once again, thanks for your help.
 
cyliyu
All those button names have to be same as 'Default' text of button.
As well as all layout!
You gotta do same as I did with that sample file.
 
Thanks, Vletm.
Got my problem solved.
It was due to the shapes name that was set at default and I have to rename 100 over shapes to match with it.
Alt + F10 will show the list of shapes name.
 
Back
Top