+ Reply to Thread
Results 1 to 15 of 15

Delete Function in macro tool

  1. #1
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Delete Function in macro tool

    Hi there,

    I have macro to fetch all the files and files related details.I'm Struck with the empty files and folder derivation.
    Here i need to add a button to select the empty files and folders and delete the selected empty files from the directory.


    Thanks,
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Delete Function in macro tool

    Please Login or Register  to view this content.
    Where fl is scripting.file and fld is scripting.folder.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Thanks Nathan for the quick reply..Here im not only gonna to delete 0MB folder and file..File which means all type of files (Which has any type of extension) need to delete

    And where i need to add this code..new module or ?

    Thanks.

  4. #4
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    OK, so you use the 'Browse' button to upload data to your userform.

    What do you mean by being "Struck with the empty files and folder derivation" (I assume you mean stuck not struck)

    What do these entries look like?

    I need a working example of the problem.

    Cheers
    Remember you are unique, like everyone else

  5. #5
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Dear noffoffine,

    Thanks..here with the macro im able to reterieve the file details of any folder or from directory.If i have any empty files/folders in the selected folder or directory means it should be listed out after clicking fetch button..Now i need a button which should retreive only a empty files and folders after fetching the results and i need to delete all the unwanted files(Means 0MB,KB) files and folders from the diretory or our local directory.Which should be done by the newly added button.Because it's very difficult to delete all the files manually ...

    Before deleting the pop up mesage should ask us for a confirmation
    And is there any option to display the deleted empty file names alone after and before deleting.

    Thanks

  6. #6
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    OK, it would help if you could post some data to Browse to.

    It might help me understand this issue better.

    Cheers

  7. #7
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    OK..this is a macro which will fetch our own system files..Pls follow the below steps .
    First Click browse button ->Select any of your folder from your system->Select the button Fetch all type of files->Then select "Fetch all files and details" button..it should display all the files details in the down excel column and rows.

    Let me know for any questions

  8. #8
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    OK, I know that I can browse to a file & fetch it but I want to use the same data as you are using.

    Can you post your file (that you browse to) or a similar example & attach it to this post?

    Thanks

  9. #9
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Dear Nof,

    As Discussed i have atttached the sample file.Pls chk and help me out.

    Thanks
    Attached Files Attached Files

  10. #10
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    Thanks so the Delete button will delete the Rows where the 'File Size' value = 0, is that what you want?

  11. #11
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Exactly Nob,

    Thanks..It would be great if i have one clear button to clear all the felds.

    Thanks

    Quote Originally Posted by noboffinme View Post
    Thanks so the Delete button will delete the Rows where the 'File Size' value = 0, is that what you want?

  12. #12
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    Here's the script, there is already some code in your file.

    Have you written that?

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Dear nob,
    Thanks..yes I have written code.I just want to add this retrived cells data clear cell and I want to delete those 0 weight files with this macro.can you please help me to delete those 0 or empty files from the directory using the button from macro tool itself..

    Thanks,

  14. #14
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Delete Function in macro tool

    Here you go.

    See the attached.

    Cheers
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    Hi Nob,

    Thanks for the response..This macro can delete the rows which has 0 mb files reports.But my requirement is ..after fetching all the file details using macro i need to delete the file/empty files from the Folder or directory path (Which path or folder we are browsing).
    Please help me on the same..
    Thanks

  16. #16
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: Delete Function in macro tool

    By using the below code am able to delete the empty folders.But i need delete all the 0 kb files present in the particular folder or directory.
    Pls help me..Also where i ll update the below code in my macro..

    Please Login or Register  to view this content.

+ 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] Macro or Function to delete rows if both criteria are not met
    By nrsChristine in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-12-2012, 07:11 PM
  2. Macro / function to delete rows in Access
    By otterlygood in forum Excel General
    Replies: 0
    Last Post: 10-19-2008, 11:21 AM
  3. optimisation tool for objective function macro
    By wjm in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-09-2006, 06:02 AM
  4. tool function
    By Jerry S in forum Excel General
    Replies: 2
    Last Post: 04-03-2005, 10:06 AM
  5. [SOLVED] Delete Line Macro - IF Function
    By PW11111 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2005, 11: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