• Privacywetgeving
    Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.

mail not send

Status
Niet open voor verdere reacties.
Outlook een handje helpen om te openen.
Code:
End If
[COLOR=#0000ff]  Application.ActivateMicrosoftApp xlMicrosoftMail[/COLOR]
  OutlApp.Visible = True
  On Error GoTo 0
 
hoi Harry

helemaal top.
loopt nu vast op einde
if iscreated then outlapp.quit

moet daanr nog een end if achter??
 
nee loopt toch door

waarom net problerm ?? ik weet het niet
enniewee danjk
 
Het zou handig zijn als je er ook bij laten weten welke foutmelding je dan krijgt.
 
Dit zou dan zo op jouw code toepasbaar zijn.
Code:
Sub mail_concorde()         ' mail naar concorde zonder pdf alleen enige tekst
Dim IsCreated As Boolean
    Dim Title As String
    Dim OutlApp As Object
    Dim strto As String
    Dim strcc As String
    Dim rng As Range
    
 
 With Sheets("gegevens")
    Title = ActiveSheet.Range("c2") & "  " & ActiveSheet.Range("c3").Value
    strcc = .Range("av64").Value
   




  On Error Resume Next
    
    Set rng = Sheets(1).Range("a1:e7").SpecialCells(xlCellTypeVisible)
    On Error GoTo 0


    If rng Is Nothing Then
        MsgBox "The selection is not a range or the sheet is protected" & _
               vbNewLine & "please correct and try again.", vbOKOnly
        Exit Sub
    End If
 
  ' Use already open Outlook if possible
  
    Set OutlApp = CreateObject("Outlook.Application")
 If OutlApp = "" Then
  Application.ActivateMicrosoftApp xlMicrosoftMail  'hsv
  OutlApp.Visible = True
 End If
  ' Prepare e-mail


  With OutlApp.CreateItem(0)
   
    ' Prepare e-mail
    .Subject = Title
    .To = strto
    '.cc = cc
    '.HTMLBody = RangetoHTML(rng)
    .Send


      MsgBox "E-mail successfully sent", vbInformation
   
  End With
OutlApp.Quit


  Set OutlApp = Nothing
 
End Sub
 
blijft melding geven

Sub mail_onofhold_opheffen_blokkade() ' mail naar coa plaatsing onofhold formulier als tekst range uit sheet
Application.EnableEvents = False

'call


Dim IsCreated As Boolean
Dim Title As String
Dim OutlApp As Object
Dim strto As String
Dim strcc As String
Dim strbcc As String
Dim rng As Range


Set rng = Nothing

Sheets("onofhold").Select
Title = Sheets("onofhold").Range("d123").Value 'is tekst samengevoegd tot 1 regel
strto = Sheets("onofhold").Range("d107").Value
strcc = Sheets("onofhold").Range("d109").Value
strbcc = Sheets("onofhold").Range("d111").Value


On Error Resume Next
' soort van body met tekst range met formulier
Set rng = Sheets("onofhold").Range("a1:j59").SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

' Use already open Outlook if possible
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If

Application.ActivateMicrosoftApp xlMicrosoftMail
OutlApp.Visible = True

On Error GoTo 0

' Prepare e-mail
With OutlApp.CreateItem(0)

' Prepare e-mail
.subject = Title
.To = strto
.cc = cc
.bcc = bcc
.HTMLBody = RangetoHTML(rng)

On Error Resume Next
.Send
Application.Visible = True
If Err Then
MsgBox "Het is niet gelukt om de E-mail te verzenden", vbExclamation
Else
MsgBox "E-mail is verzonden", vbInformation
End If
On Error GoTo 0

End With

If IsCreated Then OutlApp.Quit

Set OutlApp = Nothing

Application.EnableEvents = True

End Sub
 
En weer zet je er niet bij wat die melding dan is. Zet ook je code tussen codetags.

Daarnaast moet je bij het gebruik van een HTMLBody zowel .Display als .Send gebruiken, tevens in die volgorde.
 
Laatst bewerkt:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan