Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Georgiana69
Femeie
24 ani
Arad
cauta Barbat
24 - 47 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] VBA to Extract Date from Filename Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
My code first tries to extract date from the end of an .xlsx file, then if format is not DD.MM.YYYY it uses method from source with array, then if format is still not DD.MM.YYYY it will ask you to input manually with InputBox:



dte = ActiveWorkbook.Name
dte = Left(dte, Len(dte) - 5)
dat = Right(dte, 10)

If Not dat Like "##.##.####" Then
    Dim sDate, sDate2 As String
    dte = ActiveWorkbook.Name
    arr = Split(dte, "-")
    sDate = arr(UBound(arr))
    sDate2 = Left(sDate, 10)
    arr2 = Split(sDate2, ".")
    dat = DateSerial(arr2(2), arr2(1), arr2(0))

ElseIf Not dat Like "##.##.####" Then
    MsgBox "Data extrasa din numele fisierului excel nu e in formatul ZZ.LL.AAAA" & vbCrLf & _
            "Te rugam sa introduci manual data dispozitiei in urmatoarea caseta"
    dat = InputBox("Introdu data Lansarii in forma: ZZ.LL.AAAA", "Introdu data", Format(Date, "dd.mm.yyyy"))
End If


Source:


pus acum 1 an
   
Pagini: 1  

Mergi la