Forum Discussion
Cowtown689
Mar 14, 2026Copper Contributor
Attachment.Add issue
I have the following sub routine Private Sub Command6_Click() Dim Msg As String Msg = & ",<P> Please find attached the quote you requested." Dim O As Outlook.Application Dim M As Outlook.MailIt...
George_Hepworth
Mar 16, 2026Silver Contributor
There are a few different ways to handle this.
One might be:
...
.Attachments.Add Iif(Option1 =-1, OrderEntryProcedure, "")
...Another might be:
...
If Option1 = -1 Then
OrderEntryProcedure = "File location"
Else
OrderEntryProcedure = ""
End IfBoth assume that a ZLS would satisfy the requirement .Attachments.Add must have a value.
As an alternative, you could wrap the line .Attachments.Add OrderEntryProcedure in a conditional and only include it when Option1 <> -1.
Try those options and pick one that works in this context, or let us know if you need further refinement.