SendKeys "%{S}" Not Working anymore? (1 Viewer)

Ecc_9:10

New member
Local time
Today, 09:53
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.
 
Why can't you just use
.Send
??????
 
Use .Send instead of .Display remove the sendkeys.
Send never worked for me that's why I had to use SendKeys, however I have just added true to sendkeys line and its working. I'm not sure if this will hold up though.
 
Try the send without the display.
 
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