assistance to make a vba code run on macro file

  • Re: assistance to make a vba code run on macro file


    Thanks you KjBox for the invaluable assistance,now it clearer .:rock:


    I tried it tomorrow at office and revert back if there are any issues ,but however just for curiosity can the same code use for the serial no of hardisk or ip of the pc involved.

  • Re: assistance to make a vba code run on macro file


    You can use the machine HD Serial Number or its IP Address.


    For HD Serial Number you would need to use


    The first element in the array is my machine HD Serial number, you will need to replace the all the elements with the serial numbers of all machines that would be permitted access to your file.
    Both the codes can go in the ThisWorkbook Object Module.


    You can use the DriveSerialNumber procedure separately to run on all the machines that are to be allowed access, in order to get their HD Serial Numbers. Then use those serial numbers to manually load into the "PermittedUsers" array.


    Be attentive when getting the serial numbers, there may or may not be a minus sign at the front of the number!


    The code to retrieve a machine's IP is far more complicated and I would suggest you do not go down that path, but I will try and write the code if you really want it.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: assistance to make a vba code run on macro file


    Why are you making the ComputerName a defined name? Is that really essential for use elsewhere in your project?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: assistance to make a vba code run on macro file


    KjBox


    computername is not necessary I got it from post 1 of the original Ozgrid thread.


    However, as per your advise I stick to computernames and try hd serial no where I can swim :dolphin: , but however for later if your time permits , I would be by just curiosity to learn how ip address coding works and thanks again for hd coding:yourock:.

  • Re: assistance to make a vba code run on macro file



    Hi KjBox


    Following your code, is it achievable to modify the code to merge drive serial no and registered computer name, that is dell ,12345569(drive serial no) and so on, for workbook to open ,drive serial no and registered computer name must match for all pemitted users to open the workbook

  • Re: assistance to make a vba code run on macro file


    You could just modify the PermittedUsers array so that the entries are "Computer Name(HD Serial Number)" then change the value in the Application.Match to include computer name and the brackets.


    However, since the HD Serial Numbers will always be unique I see no advantage in using the computer name as well.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: assistance to make a vba code run on macro file


    Well I do agree, but I fell short when I notice that users adjust their computer name , so I had no alternative that to use both computer id .


    Thanks for your assistance, I tried it tommorrow at office

  • Re: assistance to make a vba code run on macro file


    That was my point. A user can change their computer name, and a computer name can be duplicated on 2 different machines. But changing a hard disc serial number is impossible and all hard discs wil have unique serial numbers.


    So using just HD Serial Number is sufficient.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!