TRaP
Moderator
Inregistrat: acum 7 ani
Postari: 811
|
|
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:
|
|