Guest_imported
New member
- Jan 1, 1970
- 0
How come the replace command doesn't work in VBA for Excel 97?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function ReplaceChars(sStr As String) As String
Dim sSearchChar As String
Dim sReplaceChar As String
Dim sTmp As String
Dim iLoc As Integer
sSearchChar = ","
sReplaceChar = "-"
iLoc = InStr(1, sStr, sSearchChar)
Do While iLoc > 0
sTmp = Left(sStr, iLoc - 1) & sReplaceChar & Right(sStr, Len(sStr) - iLoc)
sStr = sTmp
iLoc = InStr(1, sStr, sSearchChar)
Loop
ReplaceChars = sStr
End Function
FileCount = 1
Open "c:\projects\shared\output5.dat" For Binary As #1
G$ = String$(LOF(1), 0)
Get #1, 1, G$
Close #1
???replacing???
Kill "c:\projects\shared\output5.dat"
Open "c:\projects\shared\output5.dat" For Binary As #1
Put #1, 1, G$
Close #1