View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default OutMail Question

Hi Federico

See
http://www.rondebruin.nl/mail/folder3/signature.htm

--

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


"Federico Giuliani" wrote in message ...
Hi i'm using the following sub to create a email with attachments, and its works just fine.

But when i use outlook mine signature appears by itslef, but when i create the mail from excel the signature doesn't appears.

i tried to use .Signature = "name of signature"

but didn't work.

anybody knows how this works?

Thanks!

Sub Enviar_Informe()

Activeworkbook
Dim OutApp As Object
Dim OutMail As Object

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

Application.DisplayAlerts = False

ChDir "C:\temp\"
ActiveWorkbook.SaveAs Filename:= _
"C:\temp\Libro.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

body_str = "Adjunto informe de Producción." & vbNewLine & _
"" & vbNewLine & _
"Saludos" & vbNewLine & _
"" & vbNewLine & _
"Federico"

On Error Resume Next
With OutMail
.To = "produccion"
.CC = ""
.BCC = ""
.Subject = "Informe Diario de Producción"
.Body = body_str
'.Signature = "sin título"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Display
End With

ActiveWindow.Close

On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile "C:\temp\Libro.xls", force

Application.DisplayAlerts = True

End Sub