Como conceder nivel de accesos a un archivo

%3CLINGO-SUB%20id%3D%22lingo-sub-1813715%22%20slang%3D%22es-ES%22%3EHow%20to%20grant%20level%20of%20access%20to%20a%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1813715%22%20slang%3D%22es-ES%22%3E%3CP%3EI%20have%20a%20shared%20Excel%20file%20on%20my%20PC%2C%20and%20I%20granted%20read%2Fwrite%20access%20to%20different%20users%2C%20but%20I%20don't%20want%20them%20to%20be%20able%20to%20delete%20the%20file%20or%20move%20it%20from%20the%20folder%20where%20it%20is%20located%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1813715%22%20slang%3D%22es-ES%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1814725%22%20slang%3D%22de-DE%22%3ESubject%3A%20Como%20conceder%20nivel%20de%20accesos%20a%20un%20archivo%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1814725%22%20slang%3D%22de-DE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F844057%22%20target%3D%22_blank%22%3E%40RLunar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20advance%2C%20with%20your%20permission%2C%20I%20recommend%20%22setting%22%20the%20file%20yourself%20somewhere%20in%20the%20directory%20tree%20and%20only%20providing%20colleagues%20%2F%20employees%20with%20a%20link%20to%20the%20file%20(e.g.%20on%20the%20desktop).%20It's%20just%20an%20idea%2C%20if%20you%20can't%20please%20ignore%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20a%20VBA%20example%20where%20moving%20a%20file%20is%20prevented.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EPrivate%20Sub%20Workbook_Open()%0A%0AConst%20pfadname%20%3D%20%22D%3A%5Chier.xls%22%20%20%E2%80%98Insert%20your%20own%20pathname%0ADim%20oldpfad%20As%20String%20%20%20%E2%80%98pfad%20is%20path%0Aoldpfad%20%3D%20UCase(ThisWorkbook.FullName)%0A%0AIf%20oldpfad%20%26lt%3B%26gt%3B%20UCase(pfadname)%20Then%0A%20%20%20%20If%20Dir(pfadname)%20%3D%20%22%22%20Then%0A%20%20%20%20%20%20%20%20'Original%20file%20does%20not%20exist%2C%20then%20save%20it%20here%0A%20%20%20%20%20%20%20%20ThisWorkbook.SaveAs%20pfadname%0A%20%20%20%20%20%20%20%20%20'Delete%20the%20moved%20file%0A%20%20%20%20%20%20%20%20Kill%20oldpfad%0A%20%20%20%20%20%20%20%20MsgBox%20%22%20File%20has%20been%20moved%20to%20its%20old%20location.%22%0A%20%20%20%20Else%0A%20%20%20%20%20%20%20%20'Original%20file%20exists%2C%20then%20delete%20this%20file%0A%20%20%20%20%20%20%20%20With%20ThisWorkbook%0A%20%20%20%20%20%20%20%20%20%20%20%20.Saved%20%3D%20True%0A%20%20%20%20%20%20%20%20%20%20%20%20.ChangeFileAccess%20xlReadOnly%0A%20%20%20%20%20%20%20%20%20%20%20%20.IsAddin%20%3D%20True%20%20'hide%0A%20%20%20%20%20%20%20%20End%20With%0A%20%20%20%20%20%20%20%20Kill%20oldpfad%0A%20%20%20%20%20%20%20%20MsgBox%20%22Please%20use%20the%20file%20in%20the%20original%20path!%22%0A%20%20%20%20%20%20%20%20If%20Workbooks.Count%20%26gt%3B%201%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20ThisWorkbook.Close%20False%0A%20%20%20%20%20%20%20%20Else%0A%20%20%20%20%20%20%20%20%20%20%20%20ThisWorkbook.Saved%20%3D%20True%0A%20%20%20%20%20%20%20%20%20%20%20%20Application.Quit%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20End%20If%0AEnd%20If%0A%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDelete%20file%3A%3C%2FP%3E%3CP%3EAt%20the%20same%20time%2C%20the%20access%20rights%20can%20also%20be%20set%20in%20the%20server.%20That%20you%20set%20for%20each%20individual%20user%20or%20user%20group%20so%20that%20they%20cannot%20be%20deleted.%20Please%2C%20ask%20your%20system%20administrator.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20time%20to%20read%20my%20post.%20At%20the%20same%20time%2C%20I%20would%20like%20to%20emphasize%20that%20this%20is%20only%20a%20suggestion%20and%20may%20not%20suit%20you%20as%20a%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20still%20be%20very%20happy%20to%20hear%20from%20you%20whether%20it%20has%20helped%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENikolino%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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
Highlighted

@RLunar 

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."
    Else
        '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
        Else
            ThisWorkbook.Saved = True
            Application.Quit
        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

 

Nikolino

I know I don't know anything (Socrates)

Highlighted

@Nikolino Muchas gracias por su aporte 

Highlighted

@RLunar 

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 :).

Nikolino
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í.

 

 

English:

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.

 

Nikolino

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