All pastes #676631 Raw Edit

Something

public text v1 · immutable
#676631 ·published 2007-08-31 08:03 UTC
rendered paste body
Public Function DataCurenta(Optional ziua As Integer, Optional luna As Integer, Optional an As Integer, Optional separator As String)
If ziua = 1 Then
z = Day(Now)
Else: z = ""
End If
If luna = 1 Then
l = Month(Now)
Else: l = ""
End If
If an = 1 Then
a = Year(Now)
Else: a = ""
End If
DataCurenta = z & separator & l & separator & a
End Function

Public Function TimpCurent(Optional ore As Integer, Optional min As Integer, Optional sec As Integer, Optional separator As String)
If ore = 1 Then
o = Hour(Now)
Else: o = ""
End If
If min = 1 Then
m = Minute(Now)
End If
If sec = 1 Then
S = Second(Now)
Else: S = ""
End If
TimpCurent = o & separator & m & separator & S
End Function

Public Function ZiuaEste(Optional numeric As Integer, Optional literal As Integer)
If numeric = 1 Then
ziNumericazi = Format(Date, "dd")
Else: ziNumericazi = ""
End If
If literal = 1 Then
ziAzi = Format(Date, "dddd")
Else: ziAzi = ""
End If
ZiuaEste = ziNumericazi & ziAzi
End Function
'arata numele zilei curente iar weekday arata numarul zilei in saptamana de la 1 la 7
'WeekdayName(Weekday(Date, vbMonday), False, vbMonday)

Public Function astazi()
'MsgBox DatePart("d", Date, vbMonday, vbFirstJan1)
'MsgBox Weekday(Date, vbMonday)
'MsgBox WeekdayName(Weekday(Date, vbMonday), False, vbMonday)
If Weekday(Date, vbMonday) = 1 Then
astazi = "luni"
End If
If Weekday(Date, vbMonday) = 2 Then
astazi = "marti"
End If
If Weekday(Date, vbMonday) = 3 Then
astazi = "miercuri"
End If
If Weekday(Date, vbMonday) = 4 Then
astazi = "joi"

End If
If Weekday(Date, vbMonday) = 5 Then
astazi = "vineri"
End If
If Weekday(Date, vbMonday) = 6 Then
astazi = "sambata"
End If
If Weekday(Date, vbMonday) = 7 Then
astazi = "duminica"
End If
End Function

Public Function astaziSys()
'MsgBox DatePart("d", Date, vbMonday, vbFirstJan1)
'MsgBox Weekday(Date, vbMonday)
'MsgBox WeekdayName(Weekday(Date, vbMonday), False, vbMonday)
If Weekday(Date, vbMonday) = 1 Then
astaziSys = WeekdayName(1, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 2 Then
astaziSys = WeekdayName(2, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 3 Then
astaziSys = WeekdayName(3, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 4 Then
astaziSys = WeekdayName(4, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 5 Then
astaziSys = WeekdayName(5, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 6 Then
astaziSys = WeekdayName(6, False, vbMonday)
End If
If Weekday(Date, vbMonday) = 7 Then
astaziSys = WeekdayName(7, False, vbMonday)
End If
End Function

Public Function DataBackup(ziua As Integer)
DataBackup = WeekdayName(ziua, False, vbMonday)
End Function

Public Function saptamana()
Dim ini As New clsINI

If setari.luniCB.Value = 1 Then
index.lunit.ForeColor = &HFF00& ' schimba culoarea in verde daca ziua curenta este selectata din setari
 If astaziSys = DataBackup(1) Then
  index.Caption = "Astazi este Luni"
  index.lunit.ForeColor = &HFFFF& 'schimba culoarea in galben daca ziua curenta este azi
  'BackupNow 'Ruleaza functia de backup daca ziua curenta este azi
 End If
 Else: If setari.luniCB.Value = 0 Then index.lunit.ForeColor = &H808080 ' schimba culoarea in gri daca ziua curenta nu este selectata in setari
End If

If setari.martiCB.Value = 1 Then
index.martit.ForeColor = &HFF00&
 If astaziSys = DataBackup(2) Then
  index.Caption = "Astazi este Marti"
  index.martit.ForeColor = &HFFFF&
  'BackupNow
 End If
 Else: If setari.martiCB.Value = 0 Then index.martit.ForeColor = &H808080
End If

If setari.miercuriCB.Value = 1 Then
index.miercurit.ForeColor = &HFF00&
 If astaziSys = DataBackup(3) Then
  index.Caption = "Astazi este Miercuri"
  index.miercurit.ForeColor = &HFFFF&
  If runOnce = 1 Then BackupNow (3)
  End If
 Else: If setari.miercuriCB.Value = 0 Then index.miercurit.ForeColor = &H808080
End If

If setari.joiCB.Value = 1 Then
index.joit.ForeColor = &HFF00&
 If astaziSys = DataBackup(4) Then
  index.Caption = "Astazi este Joi"
  index.joit.ForeColor = &HFFFF&
  If runOnce = 1 Then BackupNow (4)
 End If
 Else: If setari.joiCB.Value = 0 Then index.joit.ForeColor = &H808080
End If

If setari.vineriCB.Value = 1 Then
index.vinerit.ForeColor = &HFF00&
 If astaziSys = DataBackup(5) Then
  index.Caption = "Astazi este Vineri"
  index.vinerit.ForeColor = &HFFFF&
  If runOnce = 1 Then BackupNow (5)
 End If
 Else: If setari.vineriCB.Value = 0 Then index.vinerit.ForeColor = &H808080
End If

If setari.sambataCB.Value = 1 Then
index.sambatat.ForeColor = &HFF00&
 If astaziSys = DataBackup(6) Then
  index.Caption = "Astazi este Sambata"
  index.sambatat.ForeColor = &HFFFF&
  'BackupNow
 End If
Else: If setari.sambataCB.Value = 0 Then index.sambatat.ForeColor = &H808080
End If

If setari.duminicaCB.Value = 1 Then
index.duminicat.ForeColor = &HFF00&
 If astaziSys = DataBackup(7) Then
  index.Caption = "Astazi este Duminica"
  index.duminicat.ForeColor = &HFFFF&
  'BackupNow
 End If
 Else: If setari.duminicaCB.Value = 0 Then index.duminicat.ForeColor = &H808080
End If
End Function

Function ResetSaptamana()
index.lunit.ForeColor = &HFF00&
index.martit.ForeColor = &HFF00&
index.miercurit.ForeColor = &HFF00&
index.joit.ForeColor = &HFF00&
index.vinerit.ForeColor = &HFF00&
index.sambatat.ForeColor = &HFF00&
index.duminicat.ForeColor = &HFF00&
End Function