One or more parameters could not be found

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi There,

I am automating the creation of emails in Excel VBA. The code works fine
for most situations but on two PCs throws the error: One or more parameters
could not be found. Has anyone had this problem?

many thanks

Tim
 
Am Sun, 18 Jun 2006 19:17:01 -0700 schrieb Tim:

Please show the code and the error causing line.
 
Thanks Michael.

After the email is displayed (correctly) the user clicks send and gets the
error "This message could not be sent. One or more parameters could not be
found"

Code as follows:


Public Sub SendMailOutlook(aTo, Subject, TextBody, aFrom, cc, strFile,
Optional strTemplate = "")

Dim Message As Outlook.MailItem
On Error GoTo 0
Const olOriginator = 0

'Create new message
If strTemplate = "" Then
Set Message = Outlook.CreateItemFromTemplate(GC_TEMPLATE_FOLDER &
"Template.oft")
Else
Set Message = Outlook.CreateItemFromTemplate(GC_TEMPLATE_FOLDER &
"Rostering Confirmation Template.oft")
End If

With Message

'Set destination email address
.Recipients.Add (aTo)
.Subject = Subject
.cc = cc

'Set sender address If specified.
If Len(aFrom) > 0 Then .Recipients.Add(aFrom).Type = olOriginator
.Attachments.Add strFile

.Display

End With

End Sub
 
Am Sun, 18 Jun 2006 22:07:01 -0700 schrieb Tim:

Tim, what happens if you´re using the Recipients collection for all
addresses and call Recipients.ResoveAll?
 
Back
Top