Private Sub mnuConvert_Click()
Call mnuCloseLog_Click 'Close Log file first
Open Temp For Input As #1 'Open log file
Open NewLogFile For Append As #2
Close #2
Close #1
End Sub
want to open a log file, stored in (Temp) delete the then save to another file (NewLogFile), whats the best way to do this, please use code i already have and decare any variables
thanks in advance
Last edited by Robbo; Dec 14th, 2004 at 11:21 AM.
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day
-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle
strFind = "" 'What To find
strReplace = "" 'What To replace it With
strDestination = CommonDialog1.FileName 'Where To put the files once they have been modified
strSource = Temp 'Where To Get the files
strFilter = "*.txt" 'wildcards
'verification complete
Dim Parse As String
Dim Hold As String
'FIND AND REPLACE
Open strSource For Input As #1 'Open log file
Do While Not EOF(1)
Line Input #1, Parse
'Hold = Hold & replace(Parse, strReplace, strFind)
Hold = Hold & replace(Parse, strFind, strReplace)
Loop
Open strDestination For Output As #2
Print #2, Hold
Close #2
Hold = ""
Parse = ""
Close #1
but it doesnt seem to be working, not taking out the in txt files??, however need the txt files as is with the line feed and character returns
please help
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day
-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle
nope that didnt work, also i seem to be losing my return(enter) and string fits on 2 lines where i want to have as original txt file (log) as attached without the squares in
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day
-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle
strReplace = "" 'What To replace it With
strDestination = CommonDialog1.FileName 'Where To put the files once they have been modified
strSource = Temp 'Where To Get the files
strFilter = "*.txt" 'wildcards
'verification complete
Dim Parse As String
Dim Hold As String
'FIND AND REPLACE
Open strSource For Input As #1 'Open log file
Open strDestination For Output As #2
Do While Not EOF(1)
Line Input #1, Parse
'Hold = Hold & replace(Parse, strReplace, strFind)
'strFind = Chr(10) 'What To find
Hold = replace(Parse, "", strReplace)
Hold = replace(Hold, "", strReplace)
Hold = replace(Hold, "", strReplace)
Print #2, Hold
Loop
Hold = ""
Parse = ""
Close #1
Close #2
cheers
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day
-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle
-----------------------------------------------
"The hall is rented,"
"the orchestra is engaged,"
"its now time to see if you can dance!"
Q, Q-Who, Star Trek The Next Generation
-----------------------------------------------
General Work day
-----------------------------------------------
DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle