Outlook Randomly Not attaching (attachment file)

Outlook not attaching code 100% of the time

  • .

    Votes: 0 0.0%
  • .

    Votes: 0 0.0%

  • Total voters
    0
Status
Not open for further replies.

Peter Berlin

Member
Outlook version
Outlook 2013 64 bit
Email Account
POP3
Hello. I am using Office 2013. I have excel vba working great except for outlook doesn't attach the file 100% of the time. Sometimes it attaches and sometimes it doesn't. It only acts up for remote (out of the office) individuals. The excel macro runs and attaches an email in outlook and saves it to the draft folder. Do I need to add a sleep command before and after the attachment code? Code is attached. Thanks, Peter

Code:
Dim OutApp As Object
    Dim OutMail As Object

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

    On Error Resume Next
    With OutMail
    .SentOnBehalfOfName = "abc@abc.com"
    '.Display
        .To = dis_contacts
        .cc = rok_contacts
        .BCC = ""
        '.Subject = "Agreement #" & Temp & " Pre Pop Form (" & strDistrict & " - " & expr_date & ")" & " Distributor: " & strDistributor & " Customer: " & cust_name
        .Subject = "Agreement #" & Temp & " Pre Pop (" & strBO & " - " & expr_date & ") " & " Customer: " & strCustomerID & " - " & cust_name & "  Distributor: " & strDistributorID & " - " & strDistributorName
       
        'SPA 4000****** Pre Pop (SubRegion - Exp Date) 99xxxxxx Customer Name 99xxxxxx APRxxx Distributor Name
       
        Dim sMsgBody As String
    sMsgBody = "......" & vbCr & vbCr
    sMsgBody = sMsgBody & "I......" & vbCr
    sMsgBody = sMsgBody & " " & vbCr
   
    .body = sMsgBody

Sleep (9000)
    .Attachments.Add (dbfile)
    .Display
Sleep (9000)
    .Save
    .Close olPromtForSave
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
M Outlook 2016 Outlook randomly unhides from taskbar Using Outlook 12
O Outlook 2013 deleting emails randomly Using Outlook 0
B Outlook 2003 randomly not auto forwarding Using Outlook 0
S Outlook 2007 Rules randomly stopping working (non-Exchange Server) Using Outlook 6
D Outlook 2010 randomly does not receive emails Using Outlook 3
F outlook 2010 favorite folder items randomly appearing / disappearing Using Outlook 1
S Type Randomly Enlarging in Email Messages in Outlook 2010 Using Outlook 7
N Email Font randomly huge when received Outlook 2007 Using Outlook 16
B Outlook 2007 - Contacts File As: is randomly changing... Using Outlook 1
H Outlook 2007 Client (w/ Connector) randomly stops working with Hotmail Using Outlook 4
R Outlook Anywhere Disconnecting Randomly Exchange Server Administration 1
R Outlook 2010 randomly converts html to rich text format Using Outlook 1
B Cursor randomly jumps in Outlook 2007 Using Outlook 0
C Exchange 2010 with Outlook 2007 clients randomly disconnecting Exchange Server Administration 5
P How do I stop Outlook 2000 randomly encrypting digitally signed emails Using Outlook 1
V Outlook 2007, "View Attachments" choice on context menu is randomly available. How do I make it alw Using Outlook 8
B SelectionChangeEventHandler randomly disappears in Outlook 2007 Outlook VBA and Custom Forms 1
D Outlook 2010 Outlook in Windows 10 keeps asking for user name and password repeatedly Using Outlook 0
S Outlook mail adressing stops after first match in GAL Using Outlook 0
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
T Changing Sent Items location in Outlook 2019 Using Outlook 0
J How do I disable advertising in Outlook 2019? Using Outlook 5
S Outlook (2016 32bit; Gmail IMAP) - Save sent message to Outllook Folder Outlook VBA and Custom Forms 0
L Unable to Sync Web/Android MS To Do with Windows Outlook Tasks Using Outlook 3
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
B Outlook Calendar not coming down from cloud Using Outlook 2
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
GregS Outlook 2016 Can I disable the Outlook Outbox? Using Outlook 2
P Outlook pst file is too huge with POP3. How to save more space? Using Outlook 4
D Outlook Contacts Notes Field Photos to Smartphone Using Outlook 0
Paula S. Outlook 2013 won't recognize new password Using Outlook 4
J Want to learn VBA Macros for Outlook. What book can you recommend? Outlook VBA and Custom Forms 2
A Backup Email Accounts On OutLook For Mac 2016 (Microsoft 365 subscription version) Using Outlook 0
J Time Zone Issues - Outlook Calendar and Webcal Feed Using Outlook 8
J Are the underlined letters in Outlook Reminders window supposed to work? Using Outlook 0
M Office 2016 Outlook is forgetting passwords Using Outlook 14
G How to add a folder shortcut to outlook quick access toolbar? Using Outlook 6
W Outlook WAS facebook but there is no info for old accounts Using Outlook 0
E Can one still buy Outlook (or Office) 2016? Using Outlook 6
G Add to Outlook Contacts - Point to non-default contacts folder Using Outlook 0
E Outlook view grouping keeps changing Using Outlook 3
Wayne Outlook locks up when opening "Manage Rules & Alerts" Using Outlook 3
G Personal Settings within Outlook Using Outlook 2
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
H Outlook 2019 Certificate error Using Outlook 2
B Outlook 2013 erratically deleting original file that is attached Using Outlook 0
V Outlook Forms: Formatting a Label with 2 different styles Outlook VBA and Custom Forms 1
X Using Outlook 2013 and Outlook 365 Using Outlook 1
Similar threads


















































Top