In the first two parts of this series the problem of the disappearing signature and the ugly fonts were addressed. Part III involves adding an attachment, when needed.
Since I was writing a subroutine to be used like a utility, the content parameters were optional. That way, I could call the subroutine with a distribution list or without, with or without someone for the CC list, with or without Subject or a message for the body. All worked fine with optional parameters. As a reminder, there is the code so far:
With EmailItem
.Display
.To = Recipients
.CC = CopiesTo
.Subject = Subj
End With
This called for another optional parameter, AttachmentLocation and this to the With EmailItem block
.Attachments.Add AttachmentLocation
It worked properly if there was a valid string passed through AttachmentLocation but error-ed when AttachmentLocation was not available. In this case the action needed to be executed after the With EmailItem block, with a controlling If.
If (AttachmentLocation) Then
ChDir (PathFromFullFileName(AttachmentLocation))
EmailItem.Attachments.Add AttachmentLocation
End If
Since I was writing a subroutine to be used like a utility, the content parameters were optional. That way, I could call the subroutine with a distribution list or without, with or without someone for the CC list, with or without Subject or a message for the body. All worked fine with optional parameters. As a reminder, there is the code so far:
With EmailItem
.Display
.To = Recipients
.CC = CopiesTo
.Subject = Subj
End With
This called for another optional parameter, AttachmentLocation and this to the With EmailItem block
.Attachments.Add AttachmentLocation
It worked properly if there was a valid string passed through AttachmentLocation but error-ed when AttachmentLocation was not available. In this case the action needed to be executed after the With EmailItem block, with a controlling If.
If (AttachmentLocation) Then
ChDir (PathFromFullFileName(AttachmentLocation))
EmailItem.Attachments.Add AttachmentLocation
End If
The IsAvailableFile is a function that tests AttachmentLocation. IsAvailableFile checks character strings to see if they point to actual files. (See Is it there?)
No comments:
Post a Comment