将打印屏幕添加到电子邮件中

时间:2016-12-06 15:58:01

标签: ms-access access-vba ms-access-2010

我有代码可以打开我的用户形式的打印屏幕 - 它有效,我知道因为当我按下Ctrl + V时它会粘贴用户形态。

我想稍微自动化,只需按一下按钮,屏幕截图就会发生,然后粘贴到自动发送的电子邮件中。但我有点卡住了:

我的代码:

    Dim Email
Dim CC
Dim objOutlook    As Object
Dim objEmail      As Object
Dim strItem
Dim strFrom

Call ScreenCapture

SendEmail = MsgBox("Are you sure you want to send a team call listening email", vbYesNo)

If SendEmail = vbYes Then

strItem = "http://schemas.microsoft.com/cdo/configuration/"
strFrom = "DoNotReply@CallListening.com"

Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = CreateObject("CDO.Message")

With objEmail

    .To = Me.Combo30
    .CC = "Chris.Hopkins@sse.com"
    .From = strFrom
    .subject = "Call Listening FeedBack: " & Now()
    .Textbody = "Hi " & Me.Text8 & vbNewLine & vbNewLine _
    & "Number: " & Me.Text4 & vbNewLine _
    & "Who: " & Me.Text6 & vbNewLine _
    & "Tag: " & Me.Text12 & vbNewLine _
    & "Complaint: " & Me.Combo10 & vbNewLine _
    & "Note Added: " & Me.Combo14 & vbNewLine _
    & "Comments: " & Me.Text16 & vbNewLine & vbNewLine _
    & "Should you wish to discuss any content of this email then please reply to the following email: test@test.com" & vbNewLine & vbNewLine _
    & "Kind Regards " & vbNewLine & vbNewLine & _
    "Name Here"
    .Display

    Application.SendKeys "(^v)"

With .Configuration.Fields
        .Item(strItem & "sendusing") = 2
        .Item(strItem & "smtpserver") = "mailhost"
        .Item(strItem & "smtpserverport") = 25
        .Update
    End With
    .Send
End With

Set objEmail = Nothing
Set objOutlook = Nothing

MsgBox "Email has been sent"

Text4.Value = ""
Text6.Value = ""
Text8.Value = ""
Combo10.Value = ""
Text12.Value = ""
Text16.Value = ""
Combo14.Value = ""
Combo30.Value = ""

Else

End If

End Sub

我认为以下内容会起作用:

    .Display

Application.SendKeys "(^v)"

我收到未找到的方法或数据成员

0 个答案:

没有答案