mail met foto en of grafiek uit excel sheet

Status
Niet open voor verdere reacties.

pasan

Terugkerende gebruiker
Lid geworden
6 nov 2010
Berichten
1.110
hoi
hieronder heb ik een code van ron de bruin waarmee ik een range van een blad per mail verstuur in de body van de mail
maar als er een afbeelding of grafiek op het blad staat worden die niet weergegeven in de body van de mail.
ik heb gezocht maar helaas niet gevonden.
iemand een oplossing?

Code:
Sub Knop94_Klikken()
intkeuze = MsgBox("alles ingevuld? en klaar om te verzenden?", vbYesNo)
Select Case intkeuze
Case Is = vbYes
'
' Knop94_Klikken Macro
' blad S2 per mail versturen
' Working in Office 2000-2010
    Dim rng As Range
    Dim OutApp As Object
    Dim OutMail As Object
     ActiveSheet.Unprotect
    Set rng = Nothing
    On Error Resume Next
    'Only the visible cells in the selection
    'Set rng = Selection.SpecialCells(xlCellTypeVisible)
    'You can also use a range if you want
    Set rng = Sheets("retour S2").Range("b1:j34").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

    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    On Error Resume Next
    With OutMail
        .To = "hup@hup.nl"
        .CC = ""
        .BCC = ""
        .Subject = "nu is i goed?"
        .HTMLBody = RangetoHTML(rng)
        .Send   'or use .Display
    End With
    On Error GoTo 0

    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing
    Range("c5:i13") = ""
    Range("c15:i21") = ""
    Range("c23:i32") = ""
                Case Is = vbNo
Exit Sub
End Select
    ActiveSheet.Protect
End Sub

groet

Pasan:thumb:
 
zoeken en heb het gevonden

hieronder de macro die ook de afbeeldingen en of grafieken per mail mee zend
de beveiliging moet er wel af zijn en outlook moet al gestart zijn

Code:
Private Sub cmdmail_Click()
Sheets("jou sheet").Unprotect Password:=Sheets("wachtwoordsheet").Range("i2")
    Dim AWorksheet As Worksheet
    Dim Sendrng As Range
    Dim rng As Range

    On Error GoTo StopMacro

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    'Fill in the Worksheet/range you want to mail
    'Note: if you use one cell it will send the whole worksheet
    Set Sendrng = Worksheets("je eigen sheet").Range("B1:J50")

    'Remember the activesheet
    Set AWorksheet = ActiveSheet

    'Create the mail and send it
    With Sendrng

        ' Select the worksheet with the range you want to send
        .Parent.Select

        'Remember the ActiveCell on that worksheet
        Set rng = ActiveCell

        'Select the range you want to mail
        .Select

        ' Create the mail and send it
        ActiveWorkbook.EnvelopeVisible = True
        With .Parent.MailEnvelope

            ' Set the optional introduction field thats adds
            ' some header text to the email body.
            .Introduction = "eigen keuze ."

            ' In the "With .Item" part you can add more options
            ' See the tips on this Outlook example page.
            ' http://www.rondebruin.nl/mail/tips2.htm
            With .Item
                .To = "huppeldepup@waarheen.nl"
                .Subject = "eigen keuze "
                .Send 'display
            End With

        End With

        'select the original ActiveCell
        rng.Select
    End With

    'Activate the sheet that was active before you run the macro
    AWorksheet.Select
Sheets("jou sheet").Protect Password:=Sheets("wachtwoordsheet").Range("i2")
StopMacro:
    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
    ActiveWorkbook.EnvelopeVisible = False
End Sub

groet

Pasan:thumb:
 
helaas

helaas werkt deze code niet in excel 2000
om simpel van te worden...........

iemand nog een suggestie om het wel te laten werken in excel 2000?

groet

Pasan:confused:
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan