dir()

  1. V

    Dir function does nothing

    Hello, I have a problem on the dir function, as i run the code, it does nothing. I want to prompt a message asking to overwrite file if the file already exists in the directory. Thanks before. Sub SavePDF_Cost() Dim DocPath As String Dim DefName As String Dim EmpID As String...
  2. A

    Workaround DIR() limitation

    Ok so I am running into a problem with using the below code since I started storing it on OneDrive. Basically, what the code is supposed to do is copy the existing worksheet to a new workbook and then save the workbook; prior to this though it is supposed to delete any previous/existing version...
  3. T

    Trouble with Dir()

    Hello everyone, I am having trouble with the Dir function. This is the first time I have used it, and I don't think I understand where it searches. When I type: Dim Path As String Path = Application.ActiveWorkbook.Path MsgBox Path The Messagebox returns a path. However adding Dir: Dim...
  4. Tony Williams

    Variable doesn't return the file path with var = Dir(filepath)

    I am trying to save a file to 3 different folders on two different computers. The file path depends on which computer I am doing the save operation. I am trying to loop on a file path variable and the variable doesn't return the file path. Also, the ActiveWorkbook.SaveAs function doesn't work...
  5. L

    Dir() only works sometimes

    Hello, I have a function that finds the corresponding file path and partial file name for my input, and then uses Dir() to generate the full, actual file name. Some of my file paths are C://myfilepath/YYYY/file, and some are C://myfilepath/YYYY/MM/file. I am using <YYYY> and <MM> labels, then...
  6. U

    Getting a file name using DIR()

    I am trying to open two csv files, the first one starts with ca_ewor and the second starts with ca_pr. If I run the following commands... Dim cf As String cf = Dir(Worksheets("Sheet1").Cells(1, 2) & "\ca_ewor*.csv") cf = Dir(Worksheets("Sheet1").Cells(1, 2) & "\ca_pr*.csv") cf...
  7. T

    Looping Through a folder and Saving sheets to a New Folder

    I have the below code and I am trying to loop through one directory find all the excel files and break them out into separate sheets each saved in their own folder within a different parent directory. The sheets will all be labeled with the date convention mmddyy. The folder titles will be a...
  8. J

    Trouble looping through .dbf files

    So I'm banging my head against the wall trying to run a macro that generates a new worksheet for every .dbf file in specified directory and then copies ranges of data. The code works great for the first file but then gets hung up on that first .dbf and never advances to the subsequent files. I'm...

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