+ Reply to Thread
Results 1 to 2 of 2

Automate reading or writing depending on the user

Hybrid View

  1. #1
    Registered User
    Join Date
    01-12-2016
    Location
    france
    MS-Off Ver
    2010
    Posts
    53

    Automate reading or writing depending on the user

    Good evening everyone,

    does being not good in English I went through a translator

    infact I have a workbook with a sheet that call "admin" with my username in column A password in column B and the name of my leaves C, D, E, F, I inserted a capital X on the line corresponding to the User column of the page to which I wish him given access if no X and hide this page
    this is its gets complicated in fact I wish I could restrict access for some read-only user, and for others the total change.
    you tell me add a password to the sheet but I would like this to be so kind to automate the user "Admin" to log in my userform it otez protect him because he will have total access to the reading workbook + modification.

    if the user "Bernard" normally has access to the sheet 1 may continue to read my not change

    I hope to have was clear in my description
    thank you in advance for your assistance
    if you had any questions do not hesitate I am behind the pc

    here is my code currently used for identification in my file

        Private Sub UserForm_Initialize()
          Me.Utilisateur.List = Sheets("admin").Range("Utilisateur").Value
          Me.Utilisateur.ListIndex = 0
        End Sub
        Private Sub MotPasse_Change()
          p = Application.Match(Me.Utilisateur, Range("Utilisateur"), 0)
          mdp = Application.Index(Range("MotPasse"), p)
          If Not IsError(mdp) Then
            If Me.motpasse = CStr(mdp) Then ok = True
          End If
        End Sub
        Private Sub B_ok_Click()
          If Me.motpasse <> "" And Me.Utilisateur <> "" Then
             NbEssai = NbEssai + 1: Me.Label3.Caption = NbEssai & " essai(s)"
             For i = 1 To Range("MotPasse").Count
               If UCase(Me.motpasse) = UCase(Range("motpasse")(i)) And _
                 UCase(Me.Utilisateur) = UCase(Range("utilisateur")(i)) Then
                 For j = 1 To [feuille].Count
                   If Range("droits").Cells(i, j) = "X" Then
                      temp = Range("feuille")(j)
                      Sheets(temp).Visible = True
                   End If
                 Next j
                 Sheets("Espion").[M2] = Me.Utilisateur
                 Unload Me: Exit Sub
               End If
              Next i
           End If
           If NbEssai > 3 Then
              MsgBox NbEssai & " essais!"
              ThisWorkbook.Close False
           End If
        End Sub
    here is my page Admin
    Capture.PNG

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Automate reading or writing depending on the user

    http://www.ozgrid.com/forum/showthread.php?t=89008

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automate reading or writing depending on the user
    By ploz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2016, 03:30 PM
  2. [SOLVED] Writing and reading datafiles
    By insomniac53 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2015, 03:44 PM
  3. Reading/writing MP3 properties with Excel VBA
    By msrikanthjobs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2012, 12:11 PM
  4. VBA Chart - Reading and Writing MajorGridlines
    By revector in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2008, 12:37 AM
  5. Reading / Writing to files
    By bobdylan75 in forum Excel General
    Replies: 1
    Last Post: 05-25-2008, 04:21 PM
  6. Problems with reading / writing ini-file
    By Youp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2006, 06:40 AM
  7. [SOLVED] Reading Writing Data from One WorkBook to Another
    By John Pierce in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-30-2005, 05:05 PM

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