+ Reply to Thread
Results 1 to 9 of 9

Only open Excel Document if Computer Device name is correct

  1. #1
    Registered User
    Join Date
    03-11-2022
    Location
    South Africa, Viljoenskroon
    MS-Off Ver
    18.2110.13110.0
    Posts
    7

    Only open Excel Document if Computer Device name is correct

    Good day,

    I'm looking for VBA code that would check a computer device name. I want it to be able to give a popup saying: "Device not Registered" if the device name is not right. I also want it to work on my computer, but it shouldn't work on more than 2 computers.

    Some background: I want to sell people programs that I create on Excel, but I don't want them to give it to others for free. That is why I want it to only work on a certain device name. I already figured out how to lock my VBA and found a way to force them to activate Macros, so that won't be a problem. All I need is some code that will check if the device name is one of the 2 that is allowed.

    Thanks for the help in advance!

    Regards,
    Bodey

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,033

    Re: Only open Excel Document if Computer Device name is correct

    If you sold me that program and I wanted to get into the VBA and remove such protection, it would take me less than 10 seconds to strip the password off the VBA. Excel is NOT good with security like that.

    If someone wants to get into it and has even a modicum of knowhow, they can and will break it open.

    BSB

  3. #3
    Registered User
    Join Date
    03-11-2022
    Location
    South Africa, Viljoenskroon
    MS-Off Ver
    18.2110.13110.0
    Posts
    7

    Re: Only open Excel Document if Computer Device name is correct

    Hi, thanks for the reply. I know Excel security isn't the best, but my intent isn't to sell a program worth thousands, but rather a lot of different programs worth 5 or 10 dollars. It doesn't have to be very high security, because I will be selling to people who are completely computer illiterate.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,033

    Re: Only open Excel Document if Computer Device name is correct

    OK, then you can use Environ("ComputerName") to return the computer ID.

    Something like the below in the open event could work:
    Please Login or Register  to view this content.
    If the current "ComputerName" matches one of those specified in the first case then carry on. If not, it'll boot them out.

    However, what if my computer dies and I have to buy a new one, do I then need to buy another copy of the program from you with my new device name in the open event code?

    BSB

  5. #5
    Registered User
    Join Date
    03-11-2022
    Location
    South Africa, Viljoenskroon
    MS-Off Ver
    18.2110.13110.0
    Posts
    7

    Re: Only open Excel Document if Computer Device name is correct

    Thanks so much! I will try this and get back to you. We are still working on how to handle the "new computer" situation. For now I think we will just advertise our products as a once-off, one computer product, but I understand your point.

    Bodey

  6. #6
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,033

    Re: Only open Excel Document if Computer Device name is correct

    Good luck with it.
    Give me a shout if you need help implementing it.

    BSB

  7. #7
    Registered User
    Join Date
    03-11-2022
    Location
    South Africa, Viljoenskroon
    MS-Off Ver
    18.2110.13110.0
    Posts
    7

    Re: Only open Excel Document if Computer Device name is correct

    I do have trouble implementing this... FYI, my 2 computernames that I want to work is LAPTOP-8PM8645Q and LAPTOP-8SD8745A (Not really, for example purposes). Can you maybe rewrite the code to fit this? It keeps saying that there is a compile error. Note: I am currently working on Windows 10

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    8,033

    Re: Only open Excel Document if Computer Device name is correct

    Put the below code in the "ThisWorkbook module"

    Please Login or Register  to view this content.
    BSB

  9. #9
    Forum Contributor
    Join Date
    02-25-2022
    Location
    Dallas, Texas
    MS-Off Ver
    Office 365
    Posts
    174

    Re: Only open Excel Document if Computer Device name is correct

    I looked at this product for a company application. I never did use it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Other Computer waits until the first computer open the file close it.
    By atzdgreat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2017, 05:42 AM
  2. Excel to open when i turn on my computer
    By meus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2016, 05:39 AM
  3. Replies: 6
    Last Post: 06-28-2013, 08:44 PM
  4. open excel source document in background when i open word document
    By hootiebsc in forum Word Programming / VBA / Macros
    Replies: 5
    Last Post: 03-22-2013, 07:50 PM
  5. Error while open excel in another computer
    By mmf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2008, 08:35 AM
  6. cannot open excel documents via my computer
    By PJC118 in forum Excel General
    Replies: 1
    Last Post: 11-18-2005, 08:35 PM
  7. Replies: 7
    Last Post: 07-21-2005, 07:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1