janerussel
MIS
I need to revise my code below to search for six digits, an asterisk followed by another digit i.e.,(123456*1). This string only occurs once in the .dat file. I need to replace the "*" with a "-" in the string.
I can't use the code below because it will replace any instances of the "*" when I only want it to replace the string above.
Private Sub CmdData_Click()
Open "a:\test.dat" For Input As #1
Open "a:\testout.dat" For Output As #2
Dim intResponse As Integer
Do Until EOF(1)
Line Input #1, strInput
newstring = Replace(strInput, "*", "-"
Print #2, newstring
Loop
Close #1
Close #2
intResponse = MsgBox("The text has been updated, Exit?", _
vbYesNo + vbQuestion, "Exit Application"
If intResponse = vbYes Then
Unload frmWrite
End If
I can't use the code below because it will replace any instances of the "*" when I only want it to replace the string above.
Private Sub CmdData_Click()
Open "a:\test.dat" For Input As #1
Open "a:\testout.dat" For Output As #2
Dim intResponse As Integer
Do Until EOF(1)
Line Input #1, strInput
newstring = Replace(strInput, "*", "-"
Print #2, newstring
Loop
Close #1
Close #2
intResponse = MsgBox("The text has been updated, Exit?", _
vbYesNo + vbQuestion, "Exit Application"
If intResponse = vbYes Then
Unload frmWrite
End If