How to make excel being accessed only from one computer?

semi r

New Member
Joined
Jun 22, 2018
Messages
8
Hi Friends,

Well i appreciate your contribution and what you are giving to people, but im stuck in something about Excel.

My problem run like this:
After I have finished my work, i save it to my computer. And here is where my struggle begins! I want this doc excel file be accessed only from THIS computer. not being copy or moved by any USB or any other way.
Is there any way out to do such a thing?

I thought of putting a macro instead. I mean making up a VBA code, like : if username is My Name (for example) then Open file, if else Close.
So if someone else copies the file and open it from another computer, the moment the VBA code reads the username it wont open the file (because is another username).

Can you help me with the VBA code?

Or if there is any other way of not stealing it, can you show me a way what i can do?

Thanks in advance!

Sincerely, Sem

Best regards!
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
put this in thisworkbook


Code:
Option Explicit
Const MyPath = "C:\Users\mukesh\Desktop"
Private Sub Workbook_Open()
Dim oUserName As String
 oUserName = VBA.Environ("UserName")
 
If VBA.StrComp(oUserName, "put User ID here", vbTextCompare) <> 0 And VBA.StrComp(ThisWorkbook.Path, MyPath) <> 0 Then
  MsgBox "Your are not Authorised user of this file... please contact UserID " & oUserName
Else
 MsgBox "Welcome " & Application.UserName
End If
End Sub
 
Upvote 0
Hi MUKESHY,

Thank you for your code, but unfortunately it says that the code is incompatible with the architecture, version and so and so.. but im running excel 2016, and i dont know where my problem stands... Can you help?
 
Upvote 0
Oh wait. I put t the code on another new excel file and it said ur not authorised while it still was opened and could be accessed. it didnt close or anything like that..
 
Upvote 0
I modified it and fixed it. Very big thank you bro. But tje problem is that it says u r not authorised even i hav put my username. does it differ username from User ID?
 
Upvote 0
Excel is not a secure platform. Any VBA attempt to keep your file private will fail. (Assuming that someone actually tries to break-into/steal your file).

The best way to secure your file would be to put it on a UDB drive, not the computer, and keep that drive on your person.
 
Upvote 0
Well i fixed the VBA Code. Now no one can do anything.. bcs he doesnt know about this.The moment he gets th file and open in his computer his opening will fail and the excel file will be closed. If he is gonna open the macro for example, he will fail again cs it is password protected. So he cant do anything except wondering..
 
Upvote 0
glad you found,
it was "Exit sub" , I forgot to mentioned.
 
Upvote 0
Excel is not a secure platform. Any VBA attempt to keep your file private will fail. (Assuming that someone actually tries to break-into/steal your file).

The best way to secure your file would be to put it on a UDB drive, not the computer, and keep that drive on your person.

I'm totally agree with you.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top