+ Reply to Thread
Results 1 to 5 of 5

Delete all content if username isn't "x"

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Delete all content if username isn't "x"

    Hi there,

    is such a code even possible? If yes, why doesnt it work ? ^^

    Please Login or Register  to view this content.
    I didn't include the saving part of the workbook yet as the code above still doesn't work

    I'd really appreciate it if someone could try out my code and tell me what went wrong instead giving me another one that would do the requested task(i'd like to learn a bit this way).

    Thanks

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Delete all content if username isn't "x"

    Hi, Bishonen,

    possible? Yes. Error?

    Please Login or Register  to view this content.
    maybe better use
    Please Login or Register  to view this content.
    but why shall the procedure stop when Sheet test is coming up (if itīs the first procedure will be stopped right away)? And formost: why clear the input?

    As Application.Username can be easily changed I used the name from the system (windows):
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by jeffreybrown; 08-25-2012 at 10:14 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Delete all content if username isn't "x"

    The whole purpose of this code is to erease all content if another user tries to open the file. So if someone opens the file, all he sees is blank cells. The procedure shouldn't stop when one worksheets name is test - it should skip that one (just for test purposes). As far as i know, Application.username will do the job (the enduser won't be able to revert the clearcontents since thisworkbook.save will occur at the very end).

    thanks for the code - i screwed up with the next ws before end if.

    thanks!

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Delete all content if username isn't "x"

    Hi, Bishonen,

    saving the workbook with a password for opening would be a more secure way - if I open your workbook with 2003 and Extensions for 2007 and hold down the Shift-Key when opening the workbook I guess all you had was a plan while I see your data. Itīs possible to get the data out of a closed workbook as well. And what about taking that in consideration for your concept?

    Excel is by far the weakest software when it comes to security matters - sadly enough.

    Ciao,
    Holger

  5. #5
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Delete all content if username isn't "x"

    or
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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