londonkiwi
Programmer
Well guys, this is more a common dialog question: YES, I have looked through the posted replies first!. Would appreciate your input: The code is below.
I want to pass the read files name eg: if the file is kiwi.eco, then the "kiwi" string, to sNewFile eg the file that is being written to, giving it a new extension eg write a file named kiwi.txt
SO, I open kiwi.eco to read from, and I open kiwi.txt to write to. Of course "kiwi" could be anything.
cheers cheers cheers
Private Sub procMC_Click()
Dim sLine As String
Dim FileNumWrite As Integer
Dim lData1, lData2, lData3, lData4 As String
Dim strFilter As String 'Common dialog filter string
Dim strFileName As String 'String of file to open
Dim FileHandleRead% ' Variable to hold file handle
strFilter = "MC500(*.eco)|*.eco|Text File(*.txt)|*.txt|All files(*.*)|*.*" 'Set the common dialog filter
cdMain.Filter = strFilter
cdMain.ShowOpen ' Open the common dialog
If cdMain.FileName <> "" Then ' Make sure the retrieved filename is not a blank string
strFileName = cdMain.FileName ' if it is not blank open the file
End If
Dim sNewFile As String
sNewFile = App.Path & "\MC5500 Pre_Proc.txt"
FileHandleRead% = FreeFile 'Get a free file handle and assign it to the file handle variable
Open strFileName For Input As #FileHandleRead% 'Open the file
FileNumWrite = FreeFile
Open sNewFile For Output As #FileNumWrite
Do Until UCase(Left(sLine, 2)) = "HH" Or EOF(FileHandleRead%) ' want to find the end of file
Line Input #FileHandleRead%, sLine
Loop
Screen.MousePointer = vbHourglass ' Change mouse pointer to hourglass.
Do Until EOF(FileHandleRead%) ' code here to process line of data
etc......................................
[sig][/sig]
I want to pass the read files name eg: if the file is kiwi.eco, then the "kiwi" string, to sNewFile eg the file that is being written to, giving it a new extension eg write a file named kiwi.txt
SO, I open kiwi.eco to read from, and I open kiwi.txt to write to. Of course "kiwi" could be anything.
cheers cheers cheers
Private Sub procMC_Click()
Dim sLine As String
Dim FileNumWrite As Integer
Dim lData1, lData2, lData3, lData4 As String
Dim strFilter As String 'Common dialog filter string
Dim strFileName As String 'String of file to open
Dim FileHandleRead% ' Variable to hold file handle
strFilter = "MC500(*.eco)|*.eco|Text File(*.txt)|*.txt|All files(*.*)|*.*" 'Set the common dialog filter
cdMain.Filter = strFilter
cdMain.ShowOpen ' Open the common dialog
If cdMain.FileName <> "" Then ' Make sure the retrieved filename is not a blank string
strFileName = cdMain.FileName ' if it is not blank open the file
End If
Dim sNewFile As String
sNewFile = App.Path & "\MC5500 Pre_Proc.txt"
FileHandleRead% = FreeFile 'Get a free file handle and assign it to the file handle variable
Open strFileName For Input As #FileHandleRead% 'Open the file
FileNumWrite = FreeFile
Open sNewFile For Output As #FileNumWrite
Do Until UCase(Left(sLine, 2)) = "HH" Or EOF(FileHandleRead%) ' want to find the end of file
Line Input #FileHandleRead%, sLine
Loop
Screen.MousePointer = vbHourglass ' Change mouse pointer to hourglass.
Do Until EOF(FileHandleRead%) ' code here to process line of data
etc......................................
[sig][/sig]