Results 1 to 1 of 1

How find and replace text in a js file in a folder

Threaded View

  1. #1
    Registered User
    Join Date
    07-31-2013
    Location
    Chennai, India
    MS-Off Ver
    Excel 2010
    Posts
    64

    How find and replace text in a js file in a folder

    Hi,

    I want to replace a text var =Scorm to var =Aicc in a js file in a folder or all the folders in a directory.

    the directory path is mentioned in cell A1. I tried by harcoding the directory but it does not take the file path.
    
    Sub ReplaceStringInFile()
    Dim objFSO As Object
    Dim objFil As Object
    Dim objFil2 As Object
    Dim StrFileName As String
    Dim StrFolder As String
    Dim SstrAll As String
    
    Set objFSO = CreateObject("scripting.filesystemobject")
    StrFolder = "D:\Aicc\"
    StrFileName = Dir(StrFolder & "*Configuration.js")
    
    Do While StrFileName <> vbNullString
        Set objFil = objFSO.opentextfile(StrFolder & StrFileName)
        strAll = objFil.readall
        objFil.Close
        Set objFil2 = objFSO.createtextfile(StrFolder & StrFileName)
        objFil2.Write Replace(strAll, "Scorm", "Aicc")
        objFil2.Close
        StrFileName = Dir
    Loop
    End Sub
    Last edited by amethystfeb; 09-18-2013 at 11:58 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel VBA find and replace string in non text file and rename file
    By razzack in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 02:43 PM
  2. find in excel replace in word: find/replace text in text boxes and headers
    By dean.rogers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2012, 12:40 PM
  3. Request Excel Macro to Find & Replace in Text file
    By ganeshinscribe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2012, 07:34 AM
  4. Find & Replace Hyperlink Folder Name
    By Philmor in forum Excel General
    Replies: 1
    Last Post: 11-12-2008, 11:23 PM
  5. [SOLVED] Find and replace in every folder.
    By Steved in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2006, 08:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1