Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-01-2013, 01:28 AM
macroscope macroscope is offline How do I send an email programatically? Windows XP How do I send an email programatically? Office 2007
Novice
How do I send an email programatically?
 
Join Date: Feb 2013
Posts: 4
macroscope is on a distinguished road
Default How do I send an email programatically?

I'm using an MS Access command to open Outlook. I can get it to open, fill in address, subject, and text, but what I haven't been able to conquer is to get it to send without a mouse click on the send button within Outlook.

I want the email to fill in and send without human interaction.

Any suggestions will be appreciated.
Reply With Quote
  #2  
Old 02-01-2013, 02:07 AM
macropod's Avatar
macropod macropod is offline How do I send an email programatically? Windows 7 64bit How do I send an email programatically? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As stated on this board's opening page (https://www.msofficeforums.com/):
Quote:
Please visit AccessForum.net for Access related discussions
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-01-2013, 02:24 AM
macroscope macroscope is offline How do I send an email programatically? Windows XP How do I send an email programatically? Office 2007
Novice
How do I send an email programatically?
 
Join Date: Feb 2013
Posts: 4
macroscope is on a distinguished road
Default

I wasn't sure whether the issue was with Outlook or Access, frankly. I was hoping for the input of people well versed with Outlook and that's why I posted here.
Reply With Quote
  #4  
Old 02-01-2013, 02:39 AM
macropod's Avatar
macropod macropod is offline How do I send an email programatically? Windows 7 64bit How do I send an email programatically? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Without seeing your code, it'd be difficult for anyone to say what the problem is. Does it have a '.Send' command (eg objMailItem.Send)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-01-2013, 02:52 AM
macroscope macroscope is offline How do I send an email programatically? Windows XP How do I send an email programatically? Office 2007
Novice
How do I send an email programatically?
 
Join Date: Feb 2013
Posts: 4
macroscope is on a distinguished road
Default

No. I wasn't familiar with that command. If that's a valid command then very likely that's all I have to do.

I've actually used a macro with the SendObject action, rather than code, but I can easily change that to code to add the coded instruction. BTW, is there a similar command within a macro?
Reply With Quote
  #6  
Old 02-01-2013, 03:33 AM
macropod's Avatar
macropod macropod is offline How do I send an email programatically? Windows 7 64bit How do I send an email programatically? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The .Send command is part of the Outlook vba object model. So, yes, it's a macro command.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-01-2013, 09:19 AM
macroscope macroscope is offline How do I send an email programatically? Windows XP How do I send an email programatically? Office 2007
Novice
How do I send an email programatically?
 
Join Date: Feb 2013
Posts: 4
macroscope is on a distinguished road
Default

Just out of curiosity, how do you access .Send from within a macro?
Reply With Quote
  #8  
Old 02-01-2013, 02:27 PM
macropod's Avatar
macropod macropod is offline How do I send an email programatically? Windows 7 64bit How do I send an email programatically? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Without seeing your code, which you've still not provided, I can't tell you how/where to add it to that. Here's a generic demonstration. The code assumes you're using early binding:
Code:
Sub Demo()
Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objMailItem As Outlook.MailItem
Dim objRecipient As Outlook.Recipient
Set objOutlook = New Outlook.Application
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objRecipient
  .Add ("John Wilson")
  .Type = olTo
  .Add ("Adrian Fearnley")
  .Type = olTo
  .Add ("Chuck Feathers")
  .Type = olcc
End With
With objMailItem
  .Subject = "Financial Analysis"
  .Body = "Hi John, Adrian & Chuck," & vbCr & "I hope all's well. Here's the financial analysis." & _
      vbCr & vbCr & "Regards" & Environ("UserName")
  .Attachments.Add ("C:\Users" & Environ("UserName") & "\Documents\Financials.xls")
  .Logon , , True
  .Send
End With
Set objMailItem = Nothing: Set objNameSpace = Nothing: Set objOutlook = Nothing
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I send an email programatically? Programatically Managing Word Document Structure mlbliss Word VBA 3 11-07-2012 07:42 PM
How do I send an email programatically? Apply font color programatically using VBA Word divakarganta Word VBA 3 08-08-2012 08:05 PM
How do I send an email programatically? How to send an email to all contacts I ever send an email to? JSYdeJong Outlook 1 11-02-2011 07:22 PM
How do I send an email programatically? Can't send email helpplease Outlook 6 12-21-2008 06:00 AM
Programatically open Outlook folder (set focus) using RDO? NicMic Outlook 0 01-10-2008 03:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft