How to Use the File System Object in VBA

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024

Комментарии • 24

  • @kovacsjanos2653
    @kovacsjanos2653 3 года назад

    This was amazingly helpful. Loved the video. I have been using the file system object for some time by just blindly copy pasting sample codes off of stackoverflow. This really helped me understand what I was doing.
    Thank you

  • @ignacioa3698
    @ignacioa3698 5 лет назад +1

    Great stuff! Thank you for that, SigmaCoding! Got your prior mesg, but noticed this video before being able to respond earlier. Did not know there was a specific library for doing those files/folders iterations. Thankkk youu!
    Now additionally I should be able to leverage this same library iteration commands, as you outlined above, and build out and insert codes to also:
    (1) stop by each folder or file (or the designated folder I choose),
    (2) select the excel workbook,
    (3) open that file or excel workbook,
    (4) copy and paste whatever object type from the workbook sheet or sheet(s),
    (5) paste either a chart or table into whatever new excel workbook or Word doc, for example,I want to paste it into,
    (6) close the excel workbook I copied the info from,
    (7)continue the iteration to he next designated folder,
    (8) open up the next and designated excel workbook in the iteration, for example.
    And repeat the process again for all files or designated files and excel workbooks I choose.
    We should be able to insert those additional code instructions within this library iteration commands to achieve that?

    • @SigmaCoding
      @SigmaCoding  5 лет назад

      Yes, so your approach would work in the outline above, basically what you could do is use the GetFileName method to grab the workbook name, open it, and then run the code you normally would in that workbook. The only word of caution I would have is just to be careful with things like names, people like to change them and all that jazz. That means you could be spending a lot of time just verifying the names of workbooks, folders and stuff like that.
      However, you could also leverage the FileExsit and FolderExist method to be a check before you open it.

    • @ignacioa3698
      @ignacioa3698 5 лет назад

      @@SigmaCoding Perfect. Thank youuu!! Will most certainly do a mock run of a hypothetical scenario. And thank you again for your reply update! Much appreciated.

  • @danteencinas7020
    @danteencinas7020 2 года назад

    Fantastic.... thank you!!!

  • @scotolivera8207
    @scotolivera8207 4 года назад +1

    Thanks a lot for the video, excellent content. It will be nice if you do a video on building an app from scratch using VBA

    • @SigmaCoding
      @SigmaCoding  4 года назад

      Are you talking a UserForm application?

    • @scotolivera8207
      @scotolivera8207 4 года назад +1

      @@SigmaCoding thanks for replying, yes

    • @SigmaCoding
      @SigmaCoding  4 года назад

      Good news, I've already created a series that covers this topic. The series focuses on how to create a User Form application using Excel VBA. In essence, it's a simple "export manager" that will take an Excel object and export it to either PowerPoint or Word.
      Here is the link to the first video in the series: ruclips.net/video/RLciyc8ZFfY/видео.html
      I will be adding another series related to User Form applications that will cover how to import data from the SQL database into the User Form.

  • @Learning_With_Larry
    @Learning_With_Larry Год назад

    I have a file that I get FTP'd to me everyday from the previous day. How can I check to make sure that this file is from the day previous and not from a couple of days ago. I need to make sure that this file is from the previous day and not from a later day which would indicate that the FTP process has stopped and then I can inform someone that I need the latest file?

  • @MalinaC
    @MalinaC 4 года назад

    Awesome! Thanks for sharing!

  • @IrfanKhan-wv8rh
    @IrfanKhan-wv8rh 3 года назад

    amazing explanation..!!

  • @ignacioa3698
    @ignacioa3698 5 лет назад +1

    So towards the end, you also " built a new path", but under what scenarios would you use this option? When would you do something like that?

    • @SigmaCoding
      @SigmaCoding  5 лет назад

      To be honest, it really depends. A lot of times, we don't necessarily have a file path but we have all the components to build a path so it's just easier to pass through the built-in method rather than do all sorts of string formatting that could be prone to errors.

  • @wolfgangmetcalf9557
    @wolfgangmetcalf9557 3 года назад

    I have my code written out the same way you do but I get a compile error: method or data member not found. When I looked this up other people said i didnt fully qualify my objects.
    EDIT: it works now! I had set both variables Fils and Fil as Files. Instead Fil is supposed to be set as File without the letter S at the end.

  • @jasonpopek160
    @jasonpopek160 4 года назад

    I am using VBA with SeleniumBasic and trying to run an automated occurrence of Firefox. Due to my companies policies, location, and laws for the governing area, we cannot use Chrome to log into our systems because it is a US company, as Chrome is very easy to use this way.
    Apparently in other programming languages, e.g. Java or C#, we can use the Firefox automation using the GeckoDriver.exe. We would achieve this by using some version of the following code:
    System.setProperty("webdriver.gecko.driver", "C:/path/to/geckodriver.exe");
    Question: Is it possible using your method in order to run the Automated Firefox with newer versions of Firefox using the gecko.exe file path?
    If you can answer this question, I am sure that many people would be very appreciative as this is a very common question on the internet these days!

  • @dildokafir5058
    @dildokafir5058 5 лет назад +1

    Hello.. i do not see shell command using vba in your vba programming playlists . Are you going to create a video on shell command in no time.??

    • @SigmaCoding
      @SigmaCoding  5 лет назад

      Yes, I will be recording a video on that topic very soon.

  • @kabukijoe99
    @kabukijoe99 2 года назад

    thank you

  • @Sid1991kap
    @Sid1991kap 4 года назад

    it says "runtime error 70 permission denied" when i move file between different drives

  • @stevennye5075
    @stevennye5075 3 года назад

    well done!

  • @ericbrenner690
    @ericbrenner690 3 года назад +1

    I think you looked at the .NET DriveTypes and not the VBA Reference. 2 says its fixed, not removeable.
    docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/drivetype-property

  • @sidhnathsingh3959
    @sidhnathsingh3959 4 года назад

    Hard to understand for someone BEGINNER