+ Reply to Thread
Results 1 to 7 of 7

Corrupt

  1. #1
    Registered User
    Join Date
    06-13-2017
    Location
    Los Angles, California
    MS-Off Ver
    2010
    Posts
    3

    Corrupt

    Hi, I am deliberately trying to corrupt an excel file if the file gets moved to a different folder. What is the best way to approach this? I was thinking maybe creating a file structure within the excel file so when it does get moved, the file gets corrupted.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Corrupt

    .
    You can create a macro that deletes portions of the coding within the workbook. Combine that with a macro that verifies the workbook is 'sitting' in the specified directory / folder. If it isn't
    run the 'kill' macro.

    As far as that goes, you could actually 'kill' ( delete ) the entire workbook under the same circumstances.

    A better approach (user friendly) would be to cause the workbook to cease to function unless it is in the specified directory. If the user moves the file back, it functions as usual.

  3. #3
    Registered User
    Join Date
    06-13-2017
    Location
    Los Angles, California
    MS-Off Ver
    2010
    Posts
    3

    Re: Corrupt

    Hi thank you 'logit'
    how do I do the "better approach" ? could you provide more detailed instructions please? Thank you so much

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Corrupt

    .
    Let me provide an overview of the process ... you research the Forum and the Internet for example code that you can implement in your project ... then come back with your questions after that.
    If you are given the project outright the learning curve is omitted.

    #1:
    In the Workbook_Open module you'll want to check that the workbook is located in the correct location. Search for an explanation of the Workbook__Open module, verifying location of
    Active Workbook
    , and how to verify that location against the required location.

    #2:
    If the workbook is in the correct location, run it.

    #3:
    If the workbook is not in the correct location, advise the user of such (MsgBox, UserForm notice, etc.), then close the workbook without saving.

    It is understood the above three steps may at this point seem overwhelming but they are not. Break the process down into small steps in the order indicated above. You can do it.

    I'll answer your questions and help you along the way.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Corrupt

    Your big issue is that, for any solution to work, the user MUST enable macros (and not prevent Workbook_Open.AutoOpen macros from running).

    So you would have to ensure that the workbook was unusable without the macros. That's doable but takes a bit of effort to set up.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Registered User
    Join Date
    06-13-2017
    Location
    Los Angles, California
    MS-Off Ver
    2010
    Posts
    3

    Re: Corrupt

    'logit' thank you thank you thank you your instructions really helped thank you so much for having so much patience explaining

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Corrupt

    You are welcome. Let's see what you have when you put it together.

    Cheers.

+ 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. [SOLVED] Corrupt file
    By karl-eQ in forum Excel General
    Replies: 8
    Last Post: 01-25-2022, 07:40 AM
  2. OLE Header Corrupt, OLE Header Structure Corrupt
    By zoomtronic in forum Excel General
    Replies: 1
    Last Post: 11-26-2014, 09:54 AM
  3. Corrupt OLE Structure
    By srg55 in forum Excel General
    Replies: 7
    Last Post: 11-26-2014, 06:10 AM
  4. Corrupt or what?!
    By Oppressed1 in forum Excel General
    Replies: 19
    Last Post: 04-23-2013, 06:19 PM
  5. Windows Vista : Win Logon Corrupt
    By Mooseman60 in forum Microsoft Windows Help
    Replies: 3
    Last Post: 04-03-2012, 04:33 AM
  6. Corrupt SS?
    By Bouffant in forum Excel General
    Replies: 1
    Last Post: 03-18-2011, 10:17 PM
  7. Is it corrupt
    By kendo2748 in forum Excel General
    Replies: 5
    Last Post: 08-06-2009, 09:43 AM

Tags for this Thread

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