Restrict opening of an Excel outside the organization

exl

Board Regular
Joined
Feb 4, 2010
Messages
153
Office Version
  1. 2019
Platform
  1. Windows
I have an excel which contains classified information. It does not contain any macro. I have put in workbook level security so employees cannot check the 'veryHiddenSheets'. I am ok with employees copying the data etc, but I don't want anybody outside the organization opening it. The excel workbook should only open within the organization.

I had seen a macro somewhere which checks the username and provides relevant data, can a similar strategy be used to check for a Domain or something (bcoz our logins is within a domain) and then provide access to the document. Eagerly awaiting some answers, else I won't be able to circulate the document.
 
The macro sheet was to become visible at close, i think i have not placed the workbook unprotect code properly...
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Trty this

Code:
Option Explicit


Private Sub Workbook_Open()
'this code checks the domain, needs the function completing with your domain name
    If Not NetWorkOK("your_networkname_here") Then
        MsgBox "Not on Network"
        '-> uncomment the next line the workbook will close if the domain name is notrecognised.
        '        ThisWorkbook.Close False
    End If
    ' Loop through all worksheets
   ThisWorkbook.Unprotect Password:="Password"
'run some code


    For Each ws In ThisWorkbook.Worksheets
        'Unhide All Worksheets
        'exclude very hidden sheets
        Select Case ws.Name
        Case "Base", "Rate" '<- change the names to list all your sheets that must remain hidden
            'do nothing
        Case Else    'unhide all other sheets
            ws.Visible = xlSheetVisible
        End Select
        'Loop to next worksheet
    Next ws
    '  Hide the macro Sheet
    Sheets("Macros").Visible = xlVeryHidden
    Workbooks("Name").Protect Password:="Password"
End Sub
 
Upvote 0
Dear Roy,

Still getting the same Run Time 1004 error.

The whole thing is based on your workbook example only.
 
Upvote 0
Sorry to join late, i have a note / tip for you

all country's around the world have their own laws, in some cases states differ, and company's have employment laws and contracts, be very careful here if you locking up information from X or Y person or persons be it valid or not

You could be forced to disclose everything.......... i would strongly find out your company's stance on this before you go ahead on this


remember the domain names re only active once in session via log on screen and that's bit easy found out, just boot any corporate PC and your see the windows log on screen say

user name and password etc

Also if you make the excel security so dam tight thing can often back fire ... not having a go, just saying be careful
 
Upvote 0
That link gives an invalid entry. The original one still downloads an exe file and I get a McAfee site warning from the big button,.

DropBox or cubby are both free and safe
 
Upvote 0

Forum statistics

Threads
1,214,598
Messages
6,120,441
Members
448,966
Latest member
DannyC96

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