Delete Files And Folders Automatically

Поділитися
Вставка
  • Опубліковано 16 жов 2024
  • How to delete files and folders automatically using the File System Object (FSO) in VBA.

КОМЕНТАРІ • 16

  • @gregorytaylor2749
    @gregorytaylor2749 3 роки тому

    Thank you for yet another very useful tutorial!👍

  • @sheetsack3179
    @sheetsack3179 3 роки тому

    Can I refer to a range of folders, for example if I have such list in exl? So that the system would delete the list of folders

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      Yes - use the paths.

    • @sheetsack3179
      @sheetsack3179 3 роки тому

      @@Exceltrainingvideos thank you so much for the vid, it saved me hours of work

  • @frasier76
    @frasier76 3 роки тому

    Great VBA :-)

  • @swapnilwankhede3440
    @swapnilwankhede3440 3 роки тому

    Thank you Sir for another useful video.
    I need your small in regards to excel hyperlink function.
    I am trying to open. txt file in excel after clicking on created hyperlink, e. g.
    =hyperlink (text file location, friendly name )
    This works perfectly for word and PDF files however getting error for accessing notepad file as "cannot open the specified file "
    I would be greatful if you help me on this.
    Thanks again.

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому +1

      I just recorded a macro which I'm sharing with you. I added the 2 lines of code for the DisplayAlerts:
      Sub HyperLinkToTextFile()
      '
      ' HyperLinkToTextFile Macro
      '
      Range("A1") = "MyTextFile"
      'Range("A1").Select
      'Columns("A:A").EntireColumn.AutoFit
      Application.DisplayAlerts = False
      ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
      "C:\Users\takyar\Documents\cleaning-tank.txt", TextToDisplay:="MyTextFile"
      Application.DisplayAlerts = True
      End Sub

    • @swapnilwankhede3440
      @swapnilwankhede3440 3 роки тому

      Thank you once again Sir.
      The code is really helpful.
      The formula which I mentioned is working fine in excel 2013 hower it's throwing error in excel 2010 version.
      Instead of using code I am trying to make my template macro free.
      Please let me know if you have any further suggestions.
      Thanks.

  • @abdoudar6579
    @abdoudar6579 2 роки тому

    hi can i delete files automatically when a usb drive is inserted.whitout click on a run button ? thanks

    • @Exceltrainingvideos
      @Exceltrainingvideos  2 роки тому +1

      Try using the task scheduler to open the file and then call the macro from the workbook_open event. The following tutorials will help:
      www.exceltrainingvideos.com/tag/automatically-protect-workbook-with-password/
      www.exceltrainingvideos.com/launch-vb-script-using-task-scheduler/

  • @sureshnchavhan
    @sureshnchavhan 3 роки тому

    sir please guide me regarding auto update external link query data before macro run or make video in this regard thanks a lot .

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      Is the external link a link to a workbook?

    • @sureshnchavhan
      @sureshnchavhan 3 роки тому

      @@Exceltrainingvideos sir, edit link option is disable.. i have created queries and cooection from nse websites that i need to refresh daily without open it for this i am using vbScript as u explained. but its cancel refreshing data and simply maro run with same data .....please guide if possible ....may i mail u sir raegarding the same with file.

    • @sureshnchavhan
      @sureshnchavhan 3 роки тому

      @@Exceltrainingvideos please sir