+ Reply to Thread
Results 1 to 11 of 11

Time bombing to delete workbook open

  1. #1
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Post Time bombing to delete workbook open

    Hi Guys,

    I've been tried and got stuck how to create time bombing to delete workbook while opening if the workbook have been expired based on set date.
    I took this code from "http://www.cpearson.com/" and just little bit modified.
    This condition also already set:
    1. Microsoft Visual Basic For Applications Extensibility 5.3.
    2. Macro Settings and check the Trust access to the VBA project object model.

    Below the code under module1.
    Please Login or Register  to view this content.
    And the message came when debug run "compile error: argument not optional", block on the "Kill.FullName".
    My aim is to delete the workbook open if the date is expired.
    Thanks in advance and appreciate for any helps.

    Best Regards,
    Iqbal

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Time bombing to delete workbook open

    AFAIK you can't kill the open workbook you're running the macro from.

    Additionally your kill line needs to be altered.

    Have you tried running it from a personal.xlsb?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Time bombing to delete workbook open

    In ThisWorkbook:

    Please Login or Register  to view this content.
    In a code module:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Time bombing to delete workbook open

    shg,
    Hihihihi...magic..the file it's gone...you are the man "shg"
    Thank you sooooo much Bro.

    Solus,
    I will try later as your advice.

    Again thank you so much.
    Cheers

  5. #5
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Time bombing to delete workbook open

    Guys, the file will be deleted too though as attachment in mail?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Time bombing to delete workbook open

    You're welcome.

  7. #7
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Time bombing to delete workbook open

    Forum Guru "shg",
    I will ask the question: those codes will applicable to delete the file as attachment in email?
    I tried but it could not be.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Time bombing to delete workbook open

    I don't know what that means.

  9. #9
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Time bombing to delete workbook open

    I mean, if i write the code in the file then i send the file as attachment. While the receiver is opening the file, the file could not be opened due to gone directly. But the file itself will remain in the attachment. If i'd like to delete the file from the attachment too then i have to write another code to delete it from the attachment, is it?
    Again thank you "shg" for your assistance.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Time bombing to delete workbook open

    No, it will not delete it from an attachment.

  11. #11
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    174

    Re: Time bombing to delete workbook open

    OK...Thank you sir.

+ 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. How to automatically Open Workbook at particular time...???
    By marc5354 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2020, 07:11 PM
  2. [SOLVED] Need VBA code to delete all data in FP:FP In mid bet Open and close workbook from path
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-04-2014, 05:27 AM
  3. Excel to delete workbook on open
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2014, 12:28 PM
  4. open only one workbook at a time
    By gswamin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2011, 06:19 AM
  5. Open a Workbook at the Same Cell Every Time
    By wongc61 in forum Excel General
    Replies: 3
    Last Post: 07-21-2011, 05:22 PM

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