Como conceder nivel de accesos a un archivo

New Contributor

Tengo un archivo  del Excel compartido en mi PC, y concedí acceso a lectura y escritura a diferentes usuarios, pero no deseo que puedan borrar el archivo o moverlo de la carpeta donde se encuentra 

3 Replies


In advance, with your permission, I recommend "setting" the file yourself somewhere in the directory tree and only providing colleagues / employees with a link to the file (e.g. on the desktop). It's just an idea, if you can't please ignore it.


Here is a VBA example where moving a file is prevented.

Private Sub Workbook_Open()

Const pfadname = "D:\hier.xls"  ‘Insert your own pathname
Dim oldpfad As String   ‘pfad is path
oldpfad = UCase(ThisWorkbook.FullName)

If oldpfad <> UCase(pfadname) Then
    If Dir(pfadname) = "" Then
        'Original file does not exist, then save it here
        ThisWorkbook.SaveAs pfadname
         'Delete the moved file
        Kill oldpfad
        MsgBox " File has been moved to its old location."
        'Original file exists, then delete this file
        With ThisWorkbook
            .Saved = True
            .ChangeFileAccess xlReadOnly
            .IsAddin = True  'hide
        End With
        Kill oldpfad
        MsgBox "Please use the file in the original path!"
        If Workbooks.Count > 1 Then
            ThisWorkbook.Close False
            ThisWorkbook.Saved = True
        End If
    End If
End If

End Sub


Delete file:

At the same time, the access rights can also be set in the server. That you set for each individual user or user group so that they cannot be deleted. Please, ask your system administrator.


Thank you for your time to read my post. At the same time, I would like to emphasize that this is only a suggestion and may not suit you as a solution.


I would still be very happy to hear from you whether it has helped you.


Thank you for your understanding and patience



I know I don't know anything (Socrates)

@Nikolino Muchas gracias por su aporte 


Con software de traducción en español:

Espero haber podido ayudarte.
Le deseo un éxito continuo con Excel (el invento más genial desde chocola ... uh ... Microsoft! :-)))
Y ... Por favor, siga preguntando aquí. Acabo de aprender Excel con la ayuda de este foro ... casi :).

Yo se que no se nada (Sócrates)

* Por favor, marque y vote esta respuesta si ayuda, ya que será beneficioso para más miembros de la comunidad que lean aquí.




Hope I was able to help you.

I wish you continued success with Excel (the coolest invention since chocola... uh ... Microsoft! :-)))

And…Please keep asking here - I just taught myself Excel with the help of this forum.



I know I don't know anything (Socrates)


* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here