1. B

    Possible to find new file location with last known old location in VBA

    Hi everyone, I have a list of path files in my excel sheet and sometimes these paths change for whatever reason. Is it possible to find the new file path location automatically based on the last known old location? Regards, Bassie
  2. B

    How to overwrite the currently used add-in with a newer version of itself

    Hi everyone, I got most of my question in place, the add-in checks if there is a newer version and will get that newer version from the server if needed. The only thing I am struggling now is to replace the older add-in with the newer add-in while the names of both add-ins stay the same. So at...
  3. G

    Run-time error 5 with Dir

    Hi all, I have issues dealing with two common scenarios with my folder creation and document filing macro. Three scenarios exist Entity folder and sub folder exist - program files automatically This seems to be working fine as long as I do not run into any of these exceptions below Sub...
  4. Eawyne

    [VBA] Check if a cell content has a match in a folder and if yes, open file

    Hi all =) Here's what I need : => I enter a value in a cell (usually, a number, like 141KL540024) => There's an autocheck in a folder to determine if there exists a corresponding Powerpoint file (it would be 141KL540024.pptx) => If the file exists, a message box will warn us, and ask if we...
  5. M

    Formula required to clean simple formatting errors

    I have a long list in column A in excel. I am seeking for formula to clear below formatting errors: Remove Extra space or spaces appearing before text starts in a cell Remove Extra space or spaces appearing after text starts in a cell Remove comma if appearing at the end of text in a cell...
  6. J

    Dir Do Until Loop not working

    Hi guys! I have this for loop iterating through each folder in a file path, then it goes into the folder and gets the names of the files. Only problem is that while it should be getting the name of every file in each folder, it only gets the name of the first file. So I though a Do Until loop...
  7. R

    Need help with VBA code. Many thanks in advance!

    This is a modified script from this forum and it serves it purpose well. But I the issue I am having now is that currently the script copies a bunch of values from a DIR and paste it in the main worksheet. But in this the DIR the tab names of the sheet varies so the code breaks when it...
  8. K

    VBA to find file from Hyperlink

    I am new to MrExcel and would appreciate anyone 's suggestion regarding an issue I am having with Excel VBA I have an Excel concatenated text, which I turn into a hyperlink. I am trying to loop through the list and determine which ones have a file associated and which do not: The code below...
  9. B

    Modify this VBA to List all Folders, Subfolders and Files in a Directory?

    This bit of hobbled together VBA from various sources lists all files in the selected directory. They are sorted alphabetically, then enumerated in Column 1, which is also a hyperlink to the folder the file is in. Column 2 is the filename, which is a hyperlink to the actual file. Works great for...
  10. B

    Run DIR CMD From Macro

    The command dir /S /B /A:-S > FileList.xls lists every folder, subfolder and file except for system files on a worksheet. I want the user to be able to select a folder, and obtain this result without having to run a command prompt. Is there a way to run this command from VBA? Thanks.
  11. 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...
  12. Mackeral

    "DIR" Command not working

    Using Office 365 Excel I enter into Immediate BoxDir ("E:") and I get back "180601 Temp RIBBON CALLS.BAS" which isn't even a file in E:. I add Dir ("E:*.*)"and I get bck the same thing. If I useDir("E:*.Bat") Nothing shows but there is one "*.Bat" file in the directory. Any idea of what's...
  13. T

    Looping through a folder

    I want to loop through the files in a folder, select only one that is NOT Thisworkbook, do something, then exit the loop. Dim SelectedFile As String SelectedFile = Dir(PathName:="C:\MyFolder\") Do Until SelectedFile <> ThisWorkbook.Name If SelectedFile <>...
  14. M

    VBA - Dir function not working

    Hi there, This is driving me nuts! In my current workbook I have a number of references to another workbook. In the Auto_Open sub, I want to check that the filepath for that external doc is still valid, and return an info message if not so the user can update the links if necessary. As I...
  15. J

    If period "." located in string, return "File", else return "DIR"

    Dear all, I have been tasked with reviewing network directories and files to etsablish when the directories and files were last accessed. This being in an effort to remove redundant directories and data that is no longer being used. I have used the command line to extract the required data...
  16. B

    VBA .Getdetailsof

    Hey guys, :) I currently have two related problems when running a macro, hopefully someone that is more experienced than me can figure this out: Purpose of the macro: read all files within a folder (and subfolders), list various file attributes ofeach file (file size, author etc.) on a...
  17. I

    VBA - List all Files in Folder - Dir() stops part-way through

    Hey I've got emails in a desktop folder and I'm trying to list their file names in a worksheet. I've written the below code for that purpose but I'm facing a couple of problems: 1. The filenames are truncated: 20080607-MySpace pa#BFD0E4.html appears rather than 20080607-MySpace password...
  18. K

    Problem with Dir "Invalid call or argument" after getting new computer (moving from Windows 7 to 10)

    I wanted to separate this issue from my other post that also contained a second issue that was resolved. This code snippet worked fine in 7 but fails after upgrade to 10. I get "runtime error '5': Invalid call or argument" on fname = Dir: oldpath = "\\DSGAIN01\Commercial_Printing\Work...
  19. kelly mort

    LoadPicture Controls Challenge

    Hello All, I need help to figure out what I am doing wrongly here: I wanna load image control on my worksheet with this script but I think i am doing something wrongly since I can't get the result. Sub ShowPic () Dim fPath As String, sFile As String On Error resume next fPath =...
  20. L

    VBA loop through computer folder using DIR works but fails to open files (or loop won't work without dir)

    Code: Sub DirectoryLoop MyPath = "c:\*sales*.xls*" ' Set the path. MyName = Dir(MyPath) ' Retrieve the first entry. Do While MyName <> "" ' Start the loop. MsgBox (MyName) Call ProcessFile(MyName) 'This processes each file MyName = Dir() ' Get next entry. Loop End Sub Sub...

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