This works perfectly for what I am trying to do, however I have to write the exact file name every time I want it to change the words, which is obviously slower than me going in and altering it by hand which is what I do now.
I am running this from excel by the way using a button.
Firstly I would like to know if what I want is possible. Secondly what I want is for me to be able to click a button in excel and it will make the required change to all the dmo files in a single folder without me having to change the file name.
So if I say this is the file path "S:\DMO Files from CMM" and it will search the folder and make the changes to all the files. Is this possible?
Basically I have no idea how to go about this at the moment so any help would be great.
Sub Button1_Click() Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("S:\DMO Files from CMM\LH Anodised Silver 02.02.2018 - 1.dmo", ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, "FILNAM/'31862383.dmo'", "FILNAM/'31862383'") Set objFile = objFSO.OpenTextFile("S:\DMO Files from CMM\LH Anodised Silver 02.02.2018 - 1.dmo", ForWriting) objFile.WriteLine strNewText objFile.Close End Sub