Hallo,
ich möchte einen definierten Schnellbaustein in eine Outlook Mail einfügen.
Aber ich finde nirgends, wie ich das Objekt anspreche.
Weiß jemand Rat?
Danke, Tolados
Moderator: ModerationP
Dim html
html = "<!DOCTYPE html><html><body>"
html = html & "<div style=""font-family:'Arial'; font-size: 13; "">"
html = html & "Hallo {name}, <br /><br />TEXTBAUSTEIN <br />"
mail.htmlbody = html '& strSignatur
Sub InsertBuildingBlock()
Dim oInspector As Inspector
Dim oDoc As Variant
Dim wordApp As Variant
Dim oTemplate As Variant
Dim oBuildingBlock As Variant
''Or get the inspector some other way
Set oInspector = Application.ActiveInspector
If oInspector.EditorType = olEditorWord Then
''The property WordEditor is a Word.Document
Set oDoc = oInspector.WordEditor
''This inserts the firt building block in the first template
''This is based on a simple recording action in Word
Set wordApp = oDoc.Application
Set oTemplate = wordApp.templates("C:\Users\USERNAME\AppData\Roaming\Microsoft\Templates\NormalEmail.dotm") '<---anpassen
Set oBuildingBlock = oTemplate.BuildingBlockEntries("NAME SCHNELLBAUSTEIN") '<---anpassen
oBuildingBlock.Insert wordApp.Selection.Range, True '<---ggf. anpassen, hier wird entschieden, wo der Baustein eingefügt werden soll
End If
End Sub
Set oInspector = Outlook.Application.ActiveInspector
mail.HTMLBody = html & oBuildingBlock & strSignatur
mail.display
oBuildingBlock.Insert wordApp.Selection.Range, True
Zurück zu Outlook Forum (provisorisch)
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast