Libre office Macro qui ne fonctionne pas
h
Bonjour à tous, je me permets de poster ce message pour avoir un peu plus d'aide de la part des connaisseurs de Libre office (version 7.4.6.2).
J'ai une macro qui a été créée sur Excel (et qui fonctionne parfaitement depuis celui-ci) créée grâce à l'aide de la partie du forum EXCEL VBA mais qui ne fonctionne pas sur Libre Office. Au moment d'envoyer le mail, le fichier saute et la macro ne s'exécute pas...
Voici mon code et je vous joins le fichier si besoin :
REM ***** BASIC *****
Option VBASupport 1
Sub EnvoiMailRelance()
'envoi message pour chaque ligne
Dim Rep As Integer
yourmsgbox = MsgBox("Souhaitez-vous envoyer les mails ? ", vbOKCancel + vbExclamation, "Demande de confirmation")
If yourmsgbox = vbCancel Then
Exit Sub
End If
Dim tTo As String, tCC As String, tBCC As String, tSujet As String, fichier As String, objshell As Object
Set objshell = CreateObject("WScript.Shell")
dl = Cells(Rows.Count, 2).End(xlUp).Row
For i = 3 To dl
envoimail objshell, i
Next i
Set objshell = Nothing
End Sub
Option VBASupport 1
Sub EnvoiMailRelanceselection()
'envoi message pour les lignes sélectionnées par CTRL-CLICK GAUCHE
Dim Rep As Integer
yourmsgbox = MsgBox("Souhaitez-vous envoyer les mails aux personnes que vous avez sélectionnées avec CTRL-CLICK gauche)? ", vbOKCancel + vbExclamation, "Demande de confirmation")
If yourmsgbox = vbCancel Then
Exit Sub
End If
Dim tTo As String, tCC As String, tBCC As String, tSujet As String, fichier As String, objshell As Object
Set objshell = CreateObject("WScript.Shell")
For Each i In Selection.Rows
envoimail objshell, i.Row
Next i
Set objshell = Nothing
End Sub
Option VBASupport 1
Private Sub envoimail(objshell As Object, i)
' composition et envoi d'un mail thunderbird avec les infos de la ligne i via l'objet objshell
If InStr(Cells(i, "H"), "@") > 0 Then 'verifie que l'on a bien une adresse mail pour cette ligne
strHtml = "Bonjour, </font></BR>"
strHtml = strHtml & "<BR>" & _
"La demande de " & " " & Cells(i, "C") & " " & "est toujours en attente de traitement depuis le" & " " & Cells(i, "B") & ". </font></BR>"
strHtml = strHtml & "<BR>" & _
"Merci de bien vouloir la traiter au plus vite. </font></BR>"
strHtml = strHtml & "<BR>" & _
"<font color=black>Bien cordialement.</font>" & "<BR><BR>"
strHtml = strHtml & "<BR>" & _
"<font color=blue>Le secrétariat de la DRH </font>" & "<BR>"
strHtml = strHtml & "<BR><BR>"
strHtml = strHtml & ""
tTo = Cells(i, "H")
tCC = Cells(i, "I")
tSujet = Cells(i, "G") & " " & "Demande en attente" & " " & Cells(i, "C")
objshell.Exec ("%ProgramFiles%\Mozilla Thunderbird\thunderbird.exe -compose" & _
" preselectid='id1'" & ",to='" & tTo & "'" & ",cc='" & tCC & "'" & ",bcc='" & tBCC & "'" & ",subject='" & tSujet & "'" & ",body='" & strHtml & "'" & ",format='1'")
Application.Wait (Now + TimeValue("0:00:03"))
SendKeys "^{ENTER}", True
End If
End Sub
Cette macro doit permettre d'envoyer un ou plusieurs mails (avec une sélection) à des personnes pour les relancer sur un sujet.
Je vous remercie d'avance,
Hollomanne