If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Access-Outlook
Hello,
I'm using the following code to send email from Access. The problem is, many times I only want to send an email without an attachment. How can I do it without duplicating the same code, just to ignore the Attachments.Add line? Thanks With objEmail .To = wEmailAdrs " .Subject = wSubject .body = wBody .Attachments.Add wOutPut .Send End With |
#2
|
|||
|
|||
Access-Outlook
add another input variable to your sub/function and check it to add the
attachment or not. Function YourFunctionName(IncludeAtt as boolean) ..... With objEmail .To = wEmailAdrs " .Subject = wSubject .body = wBody If IncludeAtt=True then .Attachments.Add wOutPut End If .Send End With End Function Then when you call your function you use YourFunctionName(True) 'To include the attachment YourFunctionName(False) 'To exclude the attachment Try it out, if you need further help, please post your entire routine and I will revise it. -- Hope this helps, Daniel Pineault http://www.cardaconsultants.com/ For Access Tips and Examples: http://www.devhut.net Please rate this post using the vote buttons if it was helpful. "Abe Katz" wrote: Hello, I'm using the following code to send email from Access. The problem is, many times I only want to send an email without an attachment. How can I do it without duplicating the same code, just to ignore the Attachments.Add line? Thanks With objEmail .To = wEmailAdrs " .Subject = wSubject .body = wBody .Attachments.Add wOutPut .Send End With |
Thread Tools | |
Display Modes | |
|
|