dir function

  1. C

    VBA to open up folders on drive

    I looked around a bit and I haven't really been able to find what I'm looking for. Is there a way to have VBA loop through files on a drive to retrieve other excel workbooks? But, without having to use the file picker? I have over 100 file folders I need to go into. And I have multiple files...
  2. J

    Network oddity?

    Not sure if this is a problem with my code, with Win8, with our network, or something else, but I'm having some trouble with the Dir function. Specifically, I'm using the Dir function to try and pull file names from the folder, and the end result is that I can navigate to the folder, but when I...
  3. ChrisUK

    Rename files

    Hi, I have written the following code to run through the files in a named folder and identify any charactors in a second sheet and then replace with a given replacement. This works perfectly well except it doesn't go through any sub folders it finds, which is a little annoying Any one...
  4. S

    Fast file search for most recently modified file

    Greetings, I recently threw together a bit of code that parses text from the most recently modified file in a selected folder. However, the folder keeps track of job tickets at my work, and it can fill up fairly quickly. Right now, 889 .txt files are in the folder to be searched. I have...
  5. L

    VBA Finding file in directory with LARGEST file size.

    Hiya all, I've got everything working for this Macro except for one piece to this puzzle. I'm in the process of trying create an Email Attachment system that loads the "Signature" from Outlook. Our company uses multiple signatures for various types of emails (Default email Sig, Vendor sig...
  6. J

    Pull files from folder

    I'm trying to sort through and import a number of bar-delimited text files into an Excel spreadsheet, and running into trouble with the Dir function. My code follows: Option Explicit Dim wbMonthly, wbYTD As Workbook Dim strFileName, strType, strPrd, strFile As String Dim lngBlank As Long...
  7. E

    Using Dir(ActiveWorkbook.FullName) Causes Macro to Stop Working

    Hey all, I've inherited a macro that I'm trying to modify to capture additional info. Currently, the macro extracts data from all spreadsheets in a folder (that meet certain conditions). However, when I add in the commands to grab the filename, it causes the macro to only successfully loop...
  8. P

    Help! Excel VBA "Dir" statement converting ≤ and ≥ to = !!!

    Hi all, Am well and truly stumped by this one... I'm writing a file backup utility which depends on reading the contents of a bunch of folders and working out which files to copy to a backup location. Trouble is, a couple of files have "greater than / equal to" and "less than / equal to"...
  9. B

    DIR function doesn't iterate

    Hi all, When I step-through my code below, it always opens the first file in the directory "C:\Pyramid Files", but when it comes back to the Pyramid Files sub after fully processing the first file via various other subs, the VB Editor apparently doesn't like something about this line: StrFile =...
  10. M

    Find files in subdirectory of a subdirectory

    I used code from Microsoft Support (Method 2) to search through subdirectories and find a specific file. It works if I make the path specific enough so that my file is in the subdirectory of that path. However, I would like to generalize my search a bit more and name my path as a folder that is...
  11. L

    Dir Function problem

    Hi, I'm currently taking my first steps into using VBA to manipulate files, and have hit a stumbling block with the Dir function. The code below is a what I'm playing with, Sub ffile() ActiveCell = fileExists("fname") End Sub Function fileExists(fname) As String fileExists = Dir(fname) End...

Some videos you may like

This Week's Hot Topics

Top