Solved

How to enhance Excel security

Posted on 2008-11-03
1
206 Views
Last Modified: 2012-05-05
I've developed a stand-alone like application in Excel. How can I ensure the application will be used within company's laptops?
As all laptops are in the same domain. I am thinking to check user's domain at the begining before running the application. How I can achieve that in VB or any other better ideas?
0
Comment
Question by:neph1997
1 Comment
 
LVL 50

Accepted Solution

by:
Dave Brett earned 500 total points
ID: 22867889
Hi,

You could search for these domains on the Workbook Open event, if found then progress, or close your application

A couple of sample codes below that list
1) The Workbook open event
2) The domain of the current computer
3) All domains on the current network

Cheers

Dave

 

Private Sub Workbook_Open()

    Dim wshn

    Set wshn = CreateObject("wscript.network")

    Select Case wshn.userdomain

    Case "mine1", "mine2"

        'your code here

    Case Else

        C = MsgBox("Unlicensced used of this addin", vbCritical, "Warning!")

        ThisWorkbook.Close False

    End Select

End Sub
 
 

Sub Domain()

    Dim wshn

    Set wshn = CreateObject("wscript.network")

    MsgBox wshn.userdomain

End Sub
 
 

Sub All_Domains()

    Dim adsNS, adsDomain, WSHshell

    Set WSHshell = CreateObject("WScript.Shell")

    Set adsNS = GetObject("WinNT:")

    adsNS.Filter = Array("domain")

    For Each adsDomain In adsNS

        WSHshell.popup adsDomain.ADsPath

    Next

End Sub

Open in new window

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now