PDA

View Full Version : Help to Create Addins XLA for user control access



VISHAL120
06-21-2012, 01:54 PM
Hi,

i actually have the code below which verify the username from the connection sheet and if the user has been given access the file open and place the file defined toolbar and if not it give the user a message and then closes removing the file defined toolbar.

I usually have to add any new user who needs access to the file on the connection sheet.

Here the actual code :

Private Sub Workbook_Activate()

On Error Resume Next


Dim sh As Worksheet
Dim USERS As String

Worksheets("<<Main_Wip>>").Visible = True
Worksheets("<<Main_Wip>>").Activate


'>>>>>>************BLOCK ACCESS TO factory wip AS PER LOGGING NAMES DEFINED****************>>>>>>>>>>>>>>>

USERS = Environ("username")
'USERS = "VISHALS"
If Not IsError(Application.Match(USERS, Worksheets("Connection").Columns(2), 0)) Then

DOMAIN_FLECHE = Environ("userdnsdomain")

'Call unhide
Sheets("Main_Wip").Select
Range("J3").Value = Environ("username")

Sheets("CONNECTION").Visible = xlSheetVisible
Call Setup_Toolbar
Else




Sheets("<<Main_Wip>>").Activate

USERS = Environ("username")
'USERS = "VISHALS"

MsgBox " This Login Name :" & "<<" & (USERS) & ">>" + " << Access Not Granted to this Sys_Data; << Closing Down >>", vbOKOnly, "Sys_Data Control"
Call Clear_Toolbar
'ActiveWorkbook Saving

ThisWorkbook.Close savechanges:=False
Application.EnableEvents = False


End If


Application.StatusBar = "Sys_Data : Ready <<<VISHAL>>>"
End Sub



After a user has worked with the file he usually save it with the name he wants giving date, month, etc for record.



My only problem is when a user want to open a previous file where his username was not added before , he is actually getting the msg “Access Not Granted to this Sys_Data” as I have initially program; that is if username is not authorize then the file shall give the msg and close.

And now I have to go to each of the previous file add the new username so that he can open all other previous file saved before by other person. And this is a real headache work to do and takes lot of time.

I needed some help on how can I create an xla for the connection and keep it on a directory like c:\Sys_Data_Access\Sys_Connection.xla. ( normally it will be a network path as different user will use ) And every time there will be new user to add, I will add on the connection file and convert back to xla .

The user will normally open the Sys_data.xls file to work and as soon as open it searches for the XLA as the directory set, do the verification of the authorization . that is the Xla shall work as the back end to check if the user is authorize then set up the file defined toolbar and open.

I have been trying a lot workbook addinInstall but has not been able to figure out on how to make my Sys_data file to communicate with the addins as I have no experience on how to create addIns .



Am attaching a sample file to show how it is actually to have better idea.

Many thanks in advance for the kind help.

:banghead: :banghead:

VISHAL120
06-23-2012, 12:02 AM
hi ,

any help please