Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following sub will iterate through a directory you specify and make the string changes you want:</p> <pre><code>Option Explicit Sub FileProcessing() Dim fileDirectory As String Dim fileName As String Dim fileContents As String Dim inputFileNumber As Integer Dim outputFileNumber As Integer Dim iFileCount As Integer fileDirectory = "C:\deleteme\" 'Get first file in directory fileName = Dir(fileDirectory &amp; "*.*") 'Begin loop to iterate through each file Do While fileName &lt;&gt; "" If iFileCount Mod 50 Then 'Display a message in Immediate window for every 50 files Debug.Print "Working on file number " &amp; iFileCount &amp; " : " &amp; fileName End If 'Open File inputFileNumber = FreeFile Open fileDirectory &amp; fileName For Input As #inputFileNumber 'Put file contents into a variable 'NOTE: A variable-length string can contain up to approximately 2 billion (2^31) characters. fileContents = Input$(LOF(inputFileNumber), 1) 'Close the File Close #inputFileNumber 'Do your replacements fileContents = Replace(fileContents, "(", "") fileContents = Replace(fileContents, ")", "") fileContents = Replace(fileContents, "{", "") fileContents = Replace(fileContents, "}", "") fileContents = Replace(fileContents, "[", "") fileContents = Replace(fileContents, "]", "") fileContents = Replace(fileContents, ":", ";") 'Get the output file ready to write: outputFileNumber = FreeFile Open fileDirectory &amp; fileName For Output As #outputFileNumber Print #outputFileNumber, fileContents Close #outputFileNumber 'Get next file fileName = Dir Loop MsgBox "Finished" End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload