SendKeys "%{S}" Not Working anymore?

Ecc_9:10

New member
Local time
Today, 04:22
Joined
May 19, 2024
Messages
17
Hi there,

This was working and suddenly it is only opening the email and not sending automatically so SendKeys has stopped functioning.

Is there anything else I can do. (PS complete newbie - please speak in lay mans terms as best as you can, I really am just trying my best to get things working)

Private Sub cmd_Submit_Click()

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

txt_PName.SetFocus

strbody = "<BODY style = font=size:11pt; font-family:Courier New>" & _
"Hi,<br/><br/>" & _
"ID: <b>" & PID.Value & "</b><br/><br/>" & _

With OutMail

.SentOnBehalfOfName = " "
.To = ""
.CC = RE_Name.Value
.BCC = ""
.Subject = "Submission Form - " & txt_PName.Value
.HTMLBody = strbody
.Display
SendKeys "%{S}"
End With
 
Use .Send instead of .Display remove the sendkeys.
 
It gives a runtime 287 error
Hmm, seems a lot of others had the same problem, and it appears to be the late binding, from the links.
One person reckons you need to have outlook open already? before running your code, then kill it. I have always used Early Binding.


I see that I have this in one of my DBs, cannot remember why though.
Code:
            If blnDisplayMsg Then
                .Display
            Else
                .Save
                .Send
            End If

The blnDispl;ay was just a checkbox on the form, in case I wanted to view it first for some reason.
 

Users who are viewing this thread

Back
Top Bottom