带有令牌的简单Outlook样板VBA

时间:2015-08-20 13:50:53

标签: vba outlook-vba

我是一个非常新的人,我正在尝试创建VBA代码,它将替换我的Outlook会议样板中的令牌,但无法正确获取代码。任何帮助将不胜感激。

这就是我目前所拥有的:

Sub Kickoff()


Dim objreply As Outlook.MeetingItem
Dim strhtml As String
Dim strproject As String


Set myItem = Application.CreateItemFromTemplate("C:\Users\ttupper\AppData\Roaming\Microsoft\Templates\DAVA Kickoff.oft")
    myItem.Display
strproject = InputBox("Enter Application Name", "replace %appname%")

End Sub

1 个答案:

答案 0 :(得分:0)

假设你在样板文件的某个地方有appname,你就可以这样替换。

Option Explicit

Sub Kickoff()

Dim myItem As MailItem
Dim strproject As String

Set myItem = Application.CreateItemFromTemplate("C:\Users\ttupper\AppData\Roaming\Microsoft\Templates\DAVA Kickoff.oft")
myItem.Display

strproject = InputBox("Enter Application Name", "replace %appname%")
myItem.HTMLBody = Replace(myItem.HTMLBody, "appname", strproject)

End Sub