General information
Category:
Coding, syntax & commands
Title:
Mapi.sendmail gives compile error
"type mismatch: array or user defined type expected" on compile from this stmt:
SendMail = MAPISendMail(Session, 0&, Msg, recip(0), Files(0), 0&, 0&)
It doesn't like recip(0)
Here's the function within a class:
Public Function SendMail() As Long
Dim Msg As MAPIMessage
ReDim recip(0) As MapiRecip
ReDim Files(0) As MapiFile
If Recipients.Count Then
RecipToArray recip()
Else
Exit Function
End If
Msg.RecipCount = Recipients.Count
If Attachments.Count Then
AttachToArray Files()
End If
Msg.FileCount = Attachments.Count
Msg.Reserved = 0&
Msg.Subject = Subject
Msg.NoteText = Space$(Msg.FileCount + 5) & NoteText
Msg.MessageType = MessageType
Msg.DateReceived = ""
Msg.ConversationID = ""
Msg.Flags = 0&
SendMail = MAPISendMail(Session, 0&, Msg, recip(0), Files(0), 0&, 0&)
End Function
MapiRecip is defined as a public type in a bas module
Public Type MapiRecip
Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long
EntryID As String
End Type
And this is the mapi api for sendmail
Declare Function MAPISendMail Lib "MAPI32.DLL" Alias "BMAPISendMail" (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, File() As MapiFile, ByVal Flags&, ByVal Reserved&) As Long
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only