View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
new.microsoft.com new.microsoft.com is offline
external usenet poster
 
Posts: 21
Default How can I use Outlook express to send mail rather than Outlook by VBA code

I see. Ron do you know why my following code doesn't work? The mail just
displayed but not send out. Thanks

Sub SendWithAtt()

Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurrFile As String


Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)


ActiveWorkbook.Save

' CurrFile = ActiveWorkbook.path & "\" & ActiveWorkbook.Name
CurrFile = ActiveWorkbook.path & "\" & "OSAllowRates.pdf"
With olMail
.To = "
'.CC = ""
.Subject = "Testing"
.Body = "Hello"
.Attachments.Add CurrFile
.Display '
End With
Application.SendKeys "%S"

Set olMail = Nothing
Set olApp = Nothing

End Sub



"Ron de Bruin" wrote in message
...
Hi

You must use SendMail code If you want to use OE and not the Outlook
object model


--
Regards Ron de Bruin
http://www.rondebruin.nl


"new.microsoft.com" wrote in message
...
Thank you very much Ron,
Yes, but i don't understand how the Outlook Express can be called rather
than Outlook as creat object only has the outlook and no outlook express.



"Ron de Bruin" wrote in message
...
Have you seen my reply and try it ?

--
Regards Ron de Bruin
http://www.rondebruin.nl


"new.microsoft.com" wrote in message
...
How can I use Outlook express to send mail rather than Outlook by VBA
code
thanks