bookmarks halen van word document en in to en cc zetten

Status
Niet open voor verdere reacties.

bjornesto

Gebruiker
Lid geworden
16 apr 2012
Berichten
201
Ik heb een bestand in word dat moet ingevuld worden via een userform die dan bepaalde bookmarks geeft.

Eens alles is ingevuld wordt dit bestand gesloten en moeten de mensen een knop indrukken die dan de email tevoorschijn haalt (code staat hieronder)

Graag zou ik bij

de naam bookmark in word = (Name_violator) in het gedeelte to: zetten
de naam bookmark in word = (Name_manager) bijvoegen bij het gedeelte cc:

Is dit mogelijk of niet


Code:
Private Sub CommandButton1_Click()
Unload unautherized_access_DSR
    Dim oWord As Object
    Dim oDoc As Object
    
    Dim oOutlook As Object
    Dim oMail As Object
    Dim strbody As String

    Set oWord = CreateObject("Word.Application")
    Set oDoc = oWord.Documents.Open("R:\SECURITY\SHARE\Rapporten\Incidentenrapporten\Templates incidentrapporten\Unauthorized access DSR.docm")


    oDoc.ExportAsFixedFormat OutputFileName:="R:\SECURITY\SHARE\Rapporten\Incidentenrapporten\Templates incidentrapporten\Unauthorized access DSR.pdf", ExportFormat:=wdExportFormatPDF

    oWord.Quit
    
    Set oWord = Nothing

    Set oOutlook = CreateObject("Outlook.Application")
    Set oMail = oOutlook.CreateItem(0)

        strbody = "<font size=""5"" face=""Calibri""><FONT COLOR=""#2156D4"">Unauthorized access Design Study Room</FONT>" & _
                  "<br><br><font size=""3"" face=""Calibri"">Dear Mr/Ms" & _
                  "<br><br>Security noticed that you <FONT COLOR=""#FF0000"">tried</FONT> to access <FONT COLOR=""#FF0000"">the Design Study Room.</FONT>" & _
                  "<br>Security has <FONT COLOR=""#FF0000"">no notification</FONT> that you can enter this confidential area." & _
                  "<br><br>Please find the report in the attachment." & _
                  "<font size=""3"" face=""Calibri"">" & _
                  "<br><br><br>Best regards / Met vriendelijke groeten / Bien à vous " & _
                  "<br><br>Security Head Office" & _
                  "<br><b>Securitas for Toyota Motor Europe Head Office </b>" & _
                  "<br><br>Integrity, Vigilance and Helpfulness" & _
                  "<br><br>Tel : +32 2 745 20 10 (ext. 2010)" & _
                  "<br><FONT COLOR=""#FF0000"">Emergency: +32 2 745 56 00 (ext 5600)</FONT>" & _
                  "<br><FONT COLOR=""#FF0000"">Mob : +32 476 804 096</FONT>" & _
                  "<br><br>Toyota Motor Europe HO: Bourgetlaan 60 - 1140 Brussels - Belgium" & _
                  "<br><br>This e-mail and any attachments thereto may contain information that is confidential, legally privileged and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above." & _
                  "<br>Any use of the information contained herein by persons other than the designated recipient(s) is prohibited." & _
                  "<br>If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer."

    On Error Resume Next
    With oMail
        .To = ""
        .CC = "persoon1@hotmail.com; persoon2@hotmail.com; persoon3@hotmail.com; persoon4@hotmail.com"
        .Subject = "Unauthorized access DSR"
        .HTMLBody = strbody
        .Attachments.Add ("R:\SECURITY\SHARE\Rapporten\Incidentenrapporten\Templates incidentrapporten\Unauthorized access DSR.pdf")
        .Display   'or use .send
    End With
    On Error GoTo 0

    Set oMail = Nothing
    Set oOutlook = Nothing
End Sub
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan