Jump to content

Recommended Posts

Posted

can someone explain to me what wrong with this coding..pls:(

 

Private Sub getminval_Click()
'Get Minimum Value
Dim myfile2 As Integer
Dim dblX As Variant
Dim dblY As Variant
Dim dblZ As Variant
Dim strTextLine As String
Dim min_value As Integer
Dim min As Double
Dim arrText As Variant
Dim diffZ As Variant
Dim ivalue As Double
Dim i As Integer
myfile2 = FreeFile
Open mstrinpfile For Input As #myfile2
i = 0
Do While Not EOF(myfile2) = True
   Line Input #myfile2, strTextLine
   arrText = Split(strTextLine, ",")
    
   dblX(i) = arrText(0)
   dblY(i) = arrText(1)
   dblZ(i) = arrText(2)
   
   Input #myfile2, dblX(i), dblY(i), dblZ(i)
   
   ivalue = 1000
   
   diffZ = dblZ - ivalue
   
   If diffZ < 0 Then
   min = dblZ(i)
   minval.Text = Val(min)
   End If
   
   i = i + 1
       
Loop
End Sub

 

it should get minimum value by compare one by one data in the file..

Posted

Hi mien

 

Try this syntax while reading the input file.

 

Open "Your file path and filename with extension" For Input As #myfile2

 

let me know if it works for you.

 

 

Have a great day.....

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...