在 VBA 中,用不同的子字符串替换子字符串非常容易,例如objMsg.Body = Replace(objMsg.Body, "<Month\", Format(dtDate1, "mmmm"))
用"<Month>"
电子邮件正文中的当前月份替换。我以前见过与此类似的问题,但它们已经有几年的历史了,而且往往有疯狂的解决方法,几乎不值得我花时间。
mb2*_*b21 10
不,但你可以使用这个(来源):
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
Run Code Online (Sandbox Code Playgroud)
用法:
replace_chars(message_string, "string_to_be_replaced", "replacement_string")
Run Code Online (Sandbox Code Playgroud)
(顺便说一句,你现在也可以使用 JavaScript 而不是 AppleScript,搜索“JavaScript for OS X Automation”)
归档时间: |
|
查看次数: |
5440 次 |
最近记录: |