1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| For i = 1 To lngItemCount
On Error Resume Next
objItem = oCal.Items(i)
On Error GoTo 0
If Not objItem Is Nothing Then ' this is an appointment item
With objItem
début = Format(.Start, "dd/mm/yyyy hh:mm") 'Début
fin = Format(.End, "dd/mm/yyyy hh:mm") ' Fin
date1 = Format(.End, "dd/mm/yyyy") ' Date
duree = Format((.Duration / 1440) / 1, "hh:mm") ' Durée
objet = .Subject ' Objet
nom = .Location ' Nom
de = .Organizer ' De
body = Replace(.Body, "&0A", vbCrLf) 'Contenu
categories = .Categories ' Categories
End With
'objItem = Nothing
End If
'Instancier un objet Commande
ObjetCommand = New OleDbCommand
ObjetCommand.Connection = ObjetConnection
ObjetCommand.CommandType = CommandType.Text
ObjetCommand.CommandText = "INSERT INTO Calendar_net ( [Date], [début], [Fin], [Durée], [Objet], [Nom], [De], [Contenu], [Categories] ) VALUES ('" & date1 & "', '" & début & "', '" & fin & "', '" & duree & "', '" & objet & "', '" & nom & "', '" & de & "', '" & body & "', '" & categories & "')"
ObjetCommand.ExecuteNonQuery()
tmp = tmp + 1 '(oItems.Count / 8)
ProgressBar1.Value = tmp
' Nettoyage
oApp = Nothing
oNS = Nothing
début = Nothing
fin = Nothing
date1 = Nothing
duree = Nothing
objet = Nothing
nom = Nothing
de = Nothing
body = Nothing
categories = Nothing
Next i |