Hi guys,
I'm having some hard time with the following.
I have a For - Next loop in Excel that generates an Outlook MailItem drafts with embedded image using ContentID.
Works perfectly but the procedure always crashes when generating the 200th mail at the Attachments.Add with the following:
Any ideas? Is there any limit for attachments in drafts?
When I manually create a new mail in Outlook after this error and try to attach the same image file, I get the same error.
When I copy the image file, rename it and try to attach the renamed copy, it works.
When I restart Outlook, manually create a new mail in Outlook and try to attach the same image file, it works.
I know I could use a signature from AppData, but let's assume I can't and I'm forced to "create" my own signature.
Thanks in advance, I'm kinda lost
I'm having some hard time with the following.
I have a For - Next loop in Excel that generates an Outlook MailItem drafts with embedded image using ContentID.
Code:
Dim outApp as Object
Dim outMail as Object
Set outApp = CreateObject("Outlook.Application")
For i '..... blah blah some logic
Set outMail = outApp.CreateItem(0)
With outMail
.SentonBehalfofName = "something@gmail.com"
.BodyFormat = 2 'HTML format
.To = "something@gmail.com"
.Subject = "something"
[COLOR=#ff0000] .Attachments.Add "C:\wm_logo.png", olByValue, 0 'aka create a copy of the file and hide it[/COLOR]
.HTMLBody = "something" & "img src=""cid:wm_logo.png"">" 'I'm ommiting the < intentionally :-D
.GetInspector 'otherwise I get "The linked image cannot be displayed" frame with red cross...
.Close olSave
End With
Set outMail = Nothing
Next i
Set outApp = Nothing
Works perfectly but the procedure always crashes when generating the 200th mail at the Attachments.Add with the following:
Any ideas? Is there any limit for attachments in drafts?
When I manually create a new mail in Outlook after this error and try to attach the same image file, I get the same error.
When I copy the image file, rename it and try to attach the renamed copy, it works.
When I restart Outlook, manually create a new mail in Outlook and try to attach the same image file, it works.
I know I could use a signature from AppData, but let's assume I can't and I'm forced to "create" my own signature.
Thanks in advance, I'm kinda lost
Last edited: