dir

  1. W

    How can this be done?

    Hi, I am exporting from a database to an excel file, and will need to clean up some fields in the excel file before I can upload that data to a different database. in one particular cell on the exported file, where I have listed the names and emails of the company contacts, there is a value...
  2. K

    dir limitation?

    I'm using dir to find files using wildcards and specific text in the file name. The text string is a date in yyyymmdd format. The folder being searched contains thousands of files, and when I search for a recent date "20170809" it finds the file as expected. The files in this folder go all the...
  3. M

    dir function to crawl folders and list files

    I have code to list the content of one directory's files but need to list the files in multiple directories that are listed in row one of my spreadsheet (ex: m1, m2, m3) where m1, m2, m3 are folders. I cannot get the dir function to use a variable in my loop to pull the text of m1, m2, m3 in...
  4. R

    Object required error

    Dim fso As Object Dim dir As Object Dim file As Object Dim rangews As Worksheet Dim fPath As String fPath = "censored" Set rangews = ThisWorkbook.Worksheets("Sheet1") Set fso = CreateObject("Scripting.FileSystemObject") Set dir = fso.GetExtensionName(fPath) line set dir =.... gives me...
  5. B

    Open Multiple Files in Same Dir

    I have found this great code someone had wrote that when ran, allows you to select certain files in the same directory and run the same macro/procedure on each of them - in my case is just a straight copy and paste. The problem I am having with it I believe is related to the targeted 'paste...
  6. M

    How to use Dir with subfolders?

    Path = C:/root/" PicName = "wtf.jpg" If Dir$(Path & PicName) <> "" Then obj.DeleteFile (Path & PicName) End If Under root folder here are two sub folders called sub1 and sub2 How do I search for "wtf.jpg" in all sub folders?
  7. F

    Dir Function not returning next file after Custom Function called

    Hi All, I'm having trouble with a macro I have been writing. The intent is to run through all files in a specified directory, open each one and copy a predetermined sheet into my workbook. I am using sFile = Dir(sFile & "*") to loop through my files. I am using another sub (ImportSheet)...
  8. P

    Search all sheets in workbook for cell value and insert image

    I'm having trouble with my macro and I feel like I'm not seeing things clearly anymore, any help is helpful, especially with the idea of looping 1. Prompt user for folder (I have this done and I stored it as MyDir as a string) 2. Folder contains image files with names that are found in a cell...
  9. V

    List all files in server or folder using Dir

    Hi Excel Experts, This is my first post and sorry if there are any mistakes or not conform to rules while asking question. I thank everyone for making this forum a general one as many people can view the questions and learn excel. I work in excel and I want to extend the discussions of the 2...
  10. J

    Opening .xls, .xlsx, .xlsm with wildcard

    Hello, I have code that will open up a couple thousand excel files over the years one at a time and run some code. However, the extension has changed over the years. I was wondering is there a way to have excel open up all the different file types with variable file names. My guess so far is...
  11. K

    Loop through Dir and open files alphabetically

    Hello, I have a macro which I have been using to loop through all files in the directory which contains my spreadsheet with the analysis macro. The macro works perfectly, except for the fact that I just discovered that using Dir does not return files in alphabetical or file system order, but in...
  12. F

    Unable to use the "Dir" function for a FTP folder with Excel VBA

    Hi, I'm using the "Dir" function to determine if a specified folder exists on my pc locally and if not I create a new one with that name: If Len(Dir(Path, vbDirectory)) = 0 Then MkDir Path End If For example Path = "C:\list\doesthisfolderexist" It is working fine. But now I wanted to use...
  13. C

    Eliminating necessity of CMD using VBA

    Hey Guys, I`m using prompt control to create .txt files to use as data for a database in excel. I`ve come up with a VBA file that opens these .txt and import those infos to a sheet. I would like to eliminate the use of prompt and generate the same files thru VBA code. Also, I would like to...
  14. A

    Concerting a Macro to run on a Mac

    Hello, I am trying to get some code to work on a mac, and am getting a Run-time error '5' invalid procedure or argument on line 18 "Value=Dir(Folderpath, &H1F)" I realize that this means that some part of that code is not available in Excel 2011 for Mac, but am unsure which part and was...
  15. 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 =...
  16. M

    Please Help: Return Date Modified for File in Directory

    Hi, I am unsuccessfully trying to use a function to return the date modified with the below Sub AKAname. Perhaps I should rename some variable names, but I'm not really sure if that is right, or how to streamline the Function LastModified with the Sub AKAname (listed below). Any help is much...
  17. L

    DIR command not working

    I am using a function that invokes the DIR command. On my machine, that has multiple hard drives, the function works. It can check whether a directory exists on the drive the .xls file is stored on or on another drive. When I copy the .xls file with the VBA code in it to another machine, the...
  18. M

    MACRO - Check/Create Folder Structure And Save

    Hi I had previously posted something about this but I am still having problems, I am a novice with Macros. I have an Excel spreadsheet that I need to save via a Macro, however, I need it to be saved in a specific location, which is compiled in a Cell in Excel I.e. D5 - returning the following...
  19. J

    Nested Dir loops

    As I have just found out I don't think it's possible to nest Dir loops. Current code: sFile_1= Dir(sPath_Internal & "*.xls") While sFile_1<> "" ... sFile_2= Dir(sFile_1_variable & "*.xls") While sFile_2<> "" ... sFile_2= Dir sFile_1= Dir Is...
  20. kyrgan

    Using Excel to create directories?

    Hello all, I have an issue where I need to save a file to a certain directory. What I would like to do, using VBA is to check and see if the dir exists, and if it does not, go ahead and create it. In this same vein, how would one go about deleting a dir (empty or full) Thanks! K.

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top