Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Outlook and VBA

    Trying to find the code that will allow me to review and edit an email just before sending it off?

    e.g.

    ''.cc = ""
    ''.bcc = ""
    .Subject = emsubject & " " & emailofsc
    .HTMLBody = messagebodyHTML
    .somethingherethatwillletmedothat
    .DeleteAfterSubmit = False 'This would let Outlook send the note without storing it in your sent bin
    .ReadReceiptRequested = True



    Also where would I find them in the future...

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    .Visible

    will reveal the message object and then you click Send or cancel the message

    Messages should be saved in Outlook Sent folder.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    .Visible

    will reveal the message object and then you click Send or cancel the message

    Messages should be saved in Outlook Sent folder.
    I take it I should remove .send as well?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Yes, if you want to review the message first.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Yes, if you want to review the message first.
    I have

    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem


    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    'open Outlook, attach zip folder or file, send e-mail
    With MailOutLook
    .BodyFormat = olFormatHTML
    .To = "ruegen@domain.com.au"
    ''.cc = ""
    ''.bcc = ""
    .Subject = emsubject & " " & emailofsc
    .HTMLBody = messagebodyHTML
    .DeleteAfterSubmit = False 'This would let Outlook send the note without storing it in your sent bin
    .ReadReceiptRequested = True
    .Visible = True

    End With

    and I get no compose window to pop up

  6. #6
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I used

    .Display

    and it works

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Sorry, I was trying to pull from memory and apparently crossed wires.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    Sorry, I was trying to pull from memory and apparently crossed wires.
    Thats ok, having .visible helped me find .display - only thing I can see now is if the email is cancelled from sending I would like to perform an action - is that possible using outlook ?

  9. #9
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    say if a person cancels/closes the compose window instead of clicking send...

    also .display(modal) doesn't lock up access

  10. #10
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Sorry - needed to revive this one...\

    this might include .close for the mailitem but I don't know how to work this in access.

  11. #11
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Put an error trap and then exit sub or On Error Resume next just before the .display if display is the last line in the sub

  12. #12
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by ItsMe View Post
    Put an error trap and then exit sub or On Error Resume next just before the .display if display is the last line in the sub
    Problem is it doesn't cause an error - not using runtime.

  13. #13
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Ruegen View Post
    Problem is it doesn't cause an error - not using runtime.
    That does not make sense to me. If there is an error in an accdb file and you are using a full version of Access the debugger prompt will pop up. Runtime does not have a debugger. So, no prompt with RT. It is still an error that needs to be trapped or addressed somehow. This is the purpose of the full version of Access and the debugger. The full version allows you to troubleshoot and address any errors that may occur.

  14. #14
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by ItsMe View Post
    That does not make sense to me. If there is an error in an accdb file and you are using a full version of Access the debugger prompt will pop up. Runtime does not have a debugger. So, no prompt with RT. It is still an error that needs to be trapped or addressed somehow. This is the purpose of the full version of Access and the debugger. The full version allows you to troubleshoot and address any errors that may occur.
    I get no error when simply closing the compose window so I get no action with using a error trap .

  15. #15
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Then it is not a problem that needs to be addressed. You are creating an object. As long as the sub routine can finish what it needs to do, there won't be a problem. If you had additional lines that said to have the object open and then come minimize and then change color and then maximize, etc - the user would have an opportunity to interrupt the code from executing.

    This is why the DoCmd Sendobject can fail to fully execute. It is committed to sending the object.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 05-20-2014, 11:32 AM
  2. Email and Outlook
    By Douglas Post in forum Programming
    Replies: 1
    Last Post: 02-13-2012, 02:57 PM
  3. Assigning Outlook task from shared Outlook mailbox
    By Remster in forum Programming
    Replies: 2
    Last Post: 11-16-2011, 04:38 AM
  4. Outlook
    By andysmith652 in forum Access
    Replies: 5
    Last Post: 10-01-2010, 06:31 AM
  5. Outlook
    By noidea in forum Access
    Replies: 0
    Last Post: 08-01-2009, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums