View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Security Message when emailing

With normal excel menu options you can use .execute
but not with the Send button in the Outlook mail

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"DawnTreader" wrote in message ...
Hello again

here is a thought...

is there a way in vba to specifically hit a button on a toolbar? something
like:

.toolbar(1).button(1).activate

something like that? if there is couldnt we specify the email toolbar and
send button to be activated? i know that is what the sendkeys is supposed to
do, but there is a problem with that method. i have been looking at the %S
and i have noticed that the % is the alt key and the S is intended to hit the
send button. but i dont think sendkeys takes into account that you have to
hold the alt key in order to make that idea work. create an email in outlook
and hold the alt key then while still holding alt and hit the S key. it
sends. alt and then S is nothing. there is no menu in the email creationg
window that has an underlined S.

the real problem here is that i have no menu that has a send option on it.
if there was it would be as simple as using send keys to hit the alt key,
then the menu letter that was underlined and then the underlined key for
send. that would work, and it would always work. currently M$ has screwed up
and made the send function only connected to a button that we cant hit.

any other thoughts on this?

"Ron de Bruin" wrote:

See the note on my site

( SendKeys is not always reliable and this will not work on every computer)
Also you not know if Outlook is installed ?

CDO is a good option for you


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"DawnTreader" wrote in message ...
Hello again

here is where i am at:

Option Explicit
Sub SaveWorkbook()

Dim USRNM As String
Dim SunDT As String
Dim strFName As String
Dim wsh As Object
Dim fs As Object
Dim DocPath As String
Dim DirString As String
Dim OutApp As Object
Dim OutMail As Object

Set wsh = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
DocPath = wsh.SpecialFolders.Item("mydocuments")
DirString = DocPath & "\Time Cards"

With ActiveSheet
USRNM = .Range("EmployeeName").Value
SunDT = Format(.Range("SundayDate").Value, "dd-mmm-yy")

If Trim(USRNM) = "" Or Trim(SunDT) = "" Then
MsgBox "Please add Employee Name and Sunday's Date" & vbLf &
"File not saved!"
Else
If Not fs.FolderExists(DirString) Then
fs.CreateFolder DirString
End If
strFName = "TimeCard " & SunDT & " " & USRNM & ".xls"
.Parent.SaveAs DirString & "\" & strFName
End If

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = strFName
.Body = "Here is the time card for the period starting " & SunDT
.Attachments.Add ActiveWorkbook.FullName
' You can add other files also like this
' .Attachments.Add ("C:\test.txt")
' .Display
' Application.Wait (Now + TimeValue("0:00:02"))
' Application.SendKeys "%S"
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

' ActiveWorkbook.SendMail ", strFName

' Application.Quit
End With

End Sub

i dont want the user to see anything. i want them to press a button and it
is gone. but this code with .send has the security warning. and if i use the
3 lines for .display i end up with the email waiting for the send button to
be pushed. i am thinking that either sendkeys doesnt do what i thought it did
or there is something not working right within those three lines.

help? and thanks in advance.

"Ron de Bruin" wrote:

Good morning

Not working with the SendMail examples
Only for the outlook object model examples that use (Send or Display)

See
http://www.rondebruin.nl/sendmail.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"DawnTreader" wrote in message
...
Hello

slight problem...

ActiveWorkbook.SendMail ", strFName
.Display
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%S"

thats the code i am trying to get to work, but it chokes on the .Display

what does that code do? i understand the rest, but i dont know what this
does or why? it is a 403 property or something not supported.

also do i replace the send mail line or do i need to move it?

"Ron de Bruin" wrote:

Hi DawnTreader

See
http://www.rondebruin.nl/mail/prevent.htm

CDO is a good option

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"DawnTreader" wrote in message
...
Hello Noemi

how did you get the security message to go away?

i assume you mean the one where outlook warns that another program is
attempting to send email.

and someone please answer her question, i could use this as well! :)

thanks for any and all help.

"Noemi" wrote:

Hi
I read Bob Philips response in regards to disabling the security message
when emailing but I wanted to know how we could use the code attached to the
site when not all users get the security message.

I tried the message and on a computer that doesn't get the security message
the workbook would not email.

Any idea's???

Thanks
Noemi