yogeshvasu
New Member
Hello Everyone,
i am having js files in a folder , i am reading js file as text stream(notepad) using excel vba and i am replacing text in notepad by finding out the word in excel file first column and replacing same row second column data .
for example category is a text in notepad if i am searching in first column and replacing text in notepad in second column. it should not replace what ever the text searches in excel , it should replace in notepad with text starting with " some text /"
this is my js file content
//******************************************//***** Category Data for eWD Category *****//******************************************function CateList_CircuitData(){//******************************************//***** Circuit Section Part *****//******************************************
CategoryArr1["A"]="A";
CategoryArr1["B"]="B";
CategoryArr1["D"]="D";
CategoryArr1["F"]="F";
CategoryArr1["H"]="H";
CategoryArr1["I"]="I";
CategoryArr1["J"]="J";
CategoryArr1["K"]="K";
CategoryArr1["L"]="L";
CategoryArr1["M"]="M";
CategoryArr1["N"]="N";
CategoryArr1["O"]="O";
CategoryArr2["A"]="
title\" class="pagetitle\">SUB-SECTION
"+"
datalist\" name="**GI GENERAL INFORMATION**\" ***********="List_CateListMouseOver(this,\'Circuit Diagram\',\'A\',\'GI GENERAL INFORMATION\',2)">"+"datalisttbl\">"+""+""+""+""+"
datalisttd1\">GI GENERAL INFORMATIONdatalisttd2\">[img name="\" src="../../common/image/other/tri.gif\">
"+"
";in this js file i have to replace text starts with " some text " other text should not be replaced
this is my code
str_Path = Arrange_path1Set fso = CreateObject("Scripting.FileSystemObject")ForEach fil In fso.GetFolder(str_Path).Files
If fil.Type ="JS File"ThenSet txt = fil.OpenAsTextStream(1)
str_change = txt.ReadALL
Lines = DataBook.ActiveSheet.Range("A65536").End(xlUp).RowFor i =1To Lines
wer = DataBook.ActiveSheet.Cells(i,1).Value
wer2 = DataBook.ActiveSheet.Cells(i,2).Value
str_change = Replace(str_change, wer, wer2, vbTextCompare)Next iWith fil.OpenAsTextStream(2).Write str_change.CloseEndWithEndIfNext filEndSub
i am having js files in a folder , i am reading js file as text stream(notepad) using excel vba and i am replacing text in notepad by finding out the word in excel file first column and replacing same row second column data .
for example category is a text in notepad if i am searching in first column and replacing text in notepad in second column. it should not replace what ever the text searches in excel , it should replace in notepad with text starting with " some text /"
this is my js file content
//******************************************//***** Category Data for eWD Category *****//******************************************function CateList_CircuitData(){//******************************************//***** Circuit Section Part *****//******************************************
CategoryArr1["A"]="A";
CategoryArr1["B"]="B";
CategoryArr1["D"]="D";
CategoryArr1["F"]="F";
CategoryArr1["H"]="H";
CategoryArr1["I"]="I";
CategoryArr1["J"]="J";
CategoryArr1["K"]="K";
CategoryArr1["L"]="L";
CategoryArr1["M"]="M";
CategoryArr1["N"]="N";
CategoryArr1["O"]="O";
CategoryArr2["A"]="
title\" class="pagetitle\">SUB-SECTION
"+"
datalist\" name="**GI GENERAL INFORMATION**\" ***********="List_CateListMouseOver(this,\'Circuit Diagram\',\'A\',\'GI GENERAL INFORMATION\',2)">"+"datalisttbl\">"+""+""+""+""+"
datalisttd1\">GI GENERAL INFORMATIONdatalisttd2\">[img name="\" src="../../common/image/other/tri.gif\">
"+"
";in this js file i have to replace text starts with " some text " other text should not be replaced
this is my code
str_Path = Arrange_path1Set fso = CreateObject("Scripting.FileSystemObject")ForEach fil In fso.GetFolder(str_Path).Files
If fil.Type ="JS File"ThenSet txt = fil.OpenAsTextStream(1)
str_change = txt.ReadALL
Lines = DataBook.ActiveSheet.Range("A65536").End(xlUp).RowFor i =1To Lines
wer = DataBook.ActiveSheet.Cells(i,1).Value
wer2 = DataBook.ActiveSheet.Cells(i,2).Value
str_change = Replace(str_change, wer, wer2, vbTextCompare)Next iWith fil.OpenAsTextStream(2).Write str_change.CloseEndWithEndIfNext filEndSub