从 Access 2003 生成电子邮件时如何将 Lotus Notes 中的字体加粗?

发布于 2024-08-23 22:35:32 字数 3244 浏览 6 评论 0原文

我正在运行 Access 2003,并创建了一个模块,用于从 Lotus Notes 中的数据库向收件人发送电子邮件。它工作得很好,但现在我被要求“粗体”电子邮件中的特定文本,以便更容易在他们的黑莓上阅读。谁能帮我格式化文本吗?我不知道如何做到这一点......这是我正在使用的代码:

Public Sub SendQtrNotesMail(Subject As String, Recipient As String, WL As String, SQA   As String, _
DC As String, ADR As String, TDR As String, SafetyNote As String, QualityNote As String, _
ProdNote As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other mailboxes.
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1,   UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.getdatabase("", MailDbName)
 If Maildb.ISOPEN = True Then
'Already open for mail
 Else
     Maildb.openmail
 End If
'Set up the new mail document
Set MailDoc = Maildb.createdocument
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = WL & vbCrLf & SQA & vbCrLf & DC & vbCrLf & ADR & vbCrLf & TDR & vbCrLf   &vbCrLf & _
SafetyNote & vbCrLf & QualityNote & vbCrLf & ProdNote
MailDoc.SaveMessageOnSend = SaveIt
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub

并且:

Sub SendEmail()
Dim stTotw As String
Dim HoldWL As String
Dim HoldSQA As String
Dim HoldDC As String
Dim HoldADR As String
Dim HoldTDR As String
Dim HoldSafetyNotes As String
Dim HoldQualityNotes As String
Dim HoldProdNotes As String
HoldWL = "WL:  " & Forms!frmAMQtr!WL.Value
HoldSQA = "SQA:  " & Forms!frmAMQtr!SQA.Value
HoldDC = "DC:  " & Forms!frmAMQtr!DC.Value
HoldADR = "A DR:  " & Forms!frmAMQtr!ADR.Value
HoldTDR = "Total DR:  " & Forms!frmAMQtr!TDR.Value
HoldSafetyNotes = "**Safety Issues & Details:"** & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMSafetyNote.Value
HoldQualityNotes = "**Quality Issues & Details**:  " & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMQualityNote.Value
HoldProdNotes = "**Productivity Issues & Details**:  " & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMProdNote.Value
stTotw = "[email protected]"
Call SendQtrNotesMail("Test Email", stTotw, HoldWL, HoldSQA, HoldDC, HoldADR, HoldTDR, _
HoldSafetyNotes, HoldQualityNotes, HoldProdNotes, True)

End Sub

上面的粗体是我的管理层希望在电子邮件中看到的粗体内容。谁能指出我如何实现这一目标的正确方向?

I am running Access 2003 and have created a module which sends an email to recipients from the database in Lotus Notes. It works just fine, but now I have been asked to "Bold" specific text in the email so that it is easier to read on their blackberries . Can anyone help me format the text? I'm not sure how to do this.... Here is the code I am using:

Public Sub SendQtrNotesMail(Subject As String, Recipient As String, WL As String, SQA   As String, _
DC As String, ADR As String, TDR As String, SafetyNote As String, QualityNote As String, _
ProdNote As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string or using above password you can use other mailboxes.
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1,   UserName, " "))) & ".nsf"
'Open the mail database in notes
Set Maildb = Session.getdatabase("", MailDbName)
 If Maildb.ISOPEN = True Then
'Already open for mail
 Else
     Maildb.openmail
 End If
'Set up the new mail document
Set MailDoc = Maildb.createdocument
MailDoc.Form = "Memo"
MailDoc.sendto = Recipient
MailDoc.Subject = Subject
MailDoc.Body = WL & vbCrLf & SQA & vbCrLf & DC & vbCrLf & ADR & vbCrLf & TDR & vbCrLf   &vbCrLf & _
SafetyNote & vbCrLf & QualityNote & vbCrLf & ProdNote
MailDoc.SaveMessageOnSend = SaveIt
'Send the document
MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
MailDoc.Send 0, Recipient
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub

And:

Sub SendEmail()
Dim stTotw As String
Dim HoldWL As String
Dim HoldSQA As String
Dim HoldDC As String
Dim HoldADR As String
Dim HoldTDR As String
Dim HoldSafetyNotes As String
Dim HoldQualityNotes As String
Dim HoldProdNotes As String
HoldWL = "WL:  " & Forms!frmAMQtr!WL.Value
HoldSQA = "SQA:  " & Forms!frmAMQtr!SQA.Value
HoldDC = "DC:  " & Forms!frmAMQtr!DC.Value
HoldADR = "A DR:  " & Forms!frmAMQtr!ADR.Value
HoldTDR = "Total DR:  " & Forms!frmAMQtr!TDR.Value
HoldSafetyNotes = "**Safety Issues & Details:"** & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMSafetyNote.Value
HoldQualityNotes = "**Quality Issues & Details**:  " & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMQualityNote.Value
HoldProdNotes = "**Productivity Issues & Details**:  " & Forms!frmAMQtr![subfrmAMQtrNotes].Form!AMProdNote.Value
stTotw = "[email protected]"
Call SendQtrNotesMail("Test Email", stTotw, HoldWL, HoldSQA, HoldDC, HoldADR, HoldTDR, _
HoldSafetyNotes, HoldQualityNotes, HoldProdNotes, True)

End Sub

What I have Bolded above is what my management wants to see bolded in the email. Can anyone point me in the right direction on how I can accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2024-08-30 22:35:32

您好,尝试使用 NotesRichTextStyle 类,下面是设计器帮助中的示例:

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim doc As New NotesDocument(db)
  Call doc.AppendItemValue("From", session.UserName)
  Call doc.AppendItemValue("Subject", _
  "Meeting time changed")
  Dim richStyle As NotesRichTextStyle
  Set richStyle = session.CreateRichTextStyle
  Dim richText As New NotesRichTextItem(doc, "Body")
  Call richText.AppendText("The meeting is at ")
  richStyle.Bold = True
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText("3:00")
  richStyle.Bold = False
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText(" not 2:00")
  Call doc.Save(True, False)
End Sub

这是帮助的链接 --> http:// www-12。 Lotus.com/ldd/doc/domino_notes/7.0/help7_designer.nsf/2e73cbb2141acefa85256b8700688cea/7aebd0afd95906568525704a0040fc50?OpenDocument

Hi try looking into using the NotesRichTextStyle class, below is the example from the designer help:

Sub Initialize
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  Dim doc As New NotesDocument(db)
  Call doc.AppendItemValue("From", session.UserName)
  Call doc.AppendItemValue("Subject", _
  "Meeting time changed")
  Dim richStyle As NotesRichTextStyle
  Set richStyle = session.CreateRichTextStyle
  Dim richText As New NotesRichTextItem(doc, "Body")
  Call richText.AppendText("The meeting is at ")
  richStyle.Bold = True
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText("3:00")
  richStyle.Bold = False
  Call richText.AppendStyle(richStyle)
  Call richText.AppendText(" not 2:00")
  Call doc.Save(True, False)
End Sub

Here is a link to the help --> http://www-12.lotus.com/ldd/doc/domino_notes/7.0/help7_designer.nsf/2e73cbb2141acefa85256b8700688cea/7aebd0afd95906568525704a0040fc50?OpenDocument

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文