Funci贸 Left

Torna el n煤mero dels car脿cters m茅s a l'esquerra que especifiqueu d'una expressi贸 de cadena.

Sintaxi:


Left (string As String, length As Long) As String

Valor de retorn:

Cadena

Par脿metres :

string: Any string expression that you want to return the leftmost characters from.

length: Numeric expression that specifies the number of characters that you want to return. If length = 0, a zero-length string is returned. The maximum allowed value is 2,147,483,648.

L'exemple seg眉ent converteix una data en format AAAA.MM.DD a format MM/DD/AAAA.

Codis d'error

5 La crida al procediment no 茅s v脿lida

Exemple :


Sub ExampleUSDate
Dim sInput As String
Dim sUS_date As String
    sInput = InputBox("Introdu茂u una data en el format internacional 'AAAA-MM-DD'")
    sUS_date = Mid(sInput, 6, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Right(sInput, 2)
    sUS_date = sUS_date & "/"
    sUS_date = sUS_date & Left(sInput, 4)
    MsgBox sUS_date
End Sub

Ens cal la vostra ajuda!