Results 1 to 4 of 4

Thread: file path problem

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Ca
    Posts
    124

    file path problem

    Hey all

    I have this code that worked fine until i changed the file path name to allow the user to enter a input file name and an output file name. I get an error that says file not found.

    Any help?


    Vb Code++++++++++++++++++

    Private Sub Command1_Click()
    Dim sContent As String
    Dim iInputFile As Integer
    Dim iOutputFile As Integer
    Dim iFirstSpace As Long
    Dim iLineNumber As Long
    'Dim Firstfile As String
    'Dim OutputfileA As String


    iInputFile = FreeFile()
    D = Text1.Text
    'Open App.Path & "\UCUT2.T" For Input As #iInputFile ' This will open your input file in whatever
    Open App.Path & "\D" For Input As #iInputFile ' This will open your input file in whatever
    ' directory your App is in.
    'Outputfile = Text2.Text
    iOutputFile = FreeFile()
    'Open App.Path & "\UCUT3.T" For Output As #iOutputFile ' This will open your output file in whatever
    Open App.Path & "\TEXT2.TEXT" For Output As #iOutputFile ' This will open your output file in whatever
    ' directory your App is in.



    Do While Not EOF(iInputFile)
    Line Input #iInputFile, sContent
    Print #iOutputFile, sContent

    Mystr = Left(sContent, 5) = "O0000" ' Find the position of the first space

    If Mystr = True Then ' Check the first character
    Print #iOutputFile, "M00"
    Print #iOutputFile, "(New File "; "U-CUT3.T"; " Created on )"
    Print #iOutputFile, "("; Format(Now, "dddd, mmmm dd, yyyy"); ")"
    Print #iOutputFile, "("; Format(Now, "hh:mm AM/PM"); ")"
    Print #iOutputFile, "(File Name Below)"
    End If

    iFirstSpace = InStr(sContent, " ") ' Find the position of the first space
    If Mid$(sContent, iFirstSpace + 1, 1) = "X" Then ' Check the first character after the first space
    iLineNumber = CLng(Mid$(sContent, 2, iFirstSpace - 2)) + 1 ' Get the line number, then add 1
    Print #iOutputFile, "N" & iLineNumber & " G04 P1000" ' Create and print the new line

    End If
    iFirstSpace = InStr(sContent, " ") ' Find the position of the first space
    If Mid$(sContent, iFirstSpace + 1, 1) = "Z" Then ' Check the first character after the first space
    iLineNumber = CLng(Mid$(sContent, 2, iFirstSpace - 2)) + 1 ' Get the line number, then add 1
    Print #iOutputFile, "N" & iLineNumber & " G04 P1000" ' Create and print the new line


    End If
    Loop
    Close #iInputFile
    Close #iOutputFile

    End Sub
    Last edited by tiguy; Jun 17th, 2007 at 11:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width