Dim NAO As String Dim i as Long NAO = Application.GetOpenFilename i=InstrRev(NAO,"") if i>0 then TextBox1.Value=Left$(NAO,i-1) TextBox2.Value=Mid$(NAO,i+1) end if textebox3.Value=FileLen(NAO)
Private Sub CommandButton1_Click() Dim NAO As String Dim i As Long NAO = Application.GetOpenFilename i = InStrRev(NAO, "") If i > 0 Then TextBox1.Value = Left$(NAO, i - 1) TextBox2.Value = Mid$(NAO, i + 1) End If TextBox3.Value = FileLen(NAO) If Val(TextBox3) > 256000 Then ' MsgBox "la taille du fichier dépasse 250ko" TextBox1 = "" ' permet de réinitialiser les TextBox TextBox2 = "" TextBox3 = "" Else End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub CommandButton1_Click() Dim NAO As String, GO As String NAO = Application.GetOpenFilename GO = Application.GetFileLen For i = Len(NAO) To 1 Step -1 If Mid(NAO, i, 1) "" Then lendossier i: GoTo suite Next suite: TextBox1.Value = Mid(NAO, 1, lendossier - 1) TextBox2.Value = Mid(NAO, lendossier + 1, (Len(NAO) + 1) - lendossier) End If If GO(sPathFile) = INVALID_FILE_ATTRIBUTES Then GO = -1 Else GO = FileLen(sPathFile) textebox3.Value = GO End Sub
If TextBox3.Value>105200 Then '500 ko = 105200 o MsgBox("la taille du fichier dépasse 500ko", 0,"taille fichier") If TextBox3.Value<105200 Then Go To End If End If