Just messing with MAPI Message and Session controls, which on my PC, uses Outlook Express.
Can anyone tell me if these controls work if a user uses Outlook ?
Basically, do the controls recognise which mail program is default.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » MAPI Controls (VB6)
With the Mapi control, the code as below pre-determines the file attachments and, once the Mail application has opened, ie Outlook Express, it is still possible to attach more items using the “Attach” button (Common Dialog) from the program.
With the code below, there are 2 procedures “0” & “1”.
Is it possible to increase these procedures programatically to lets say attch many attachments from a list containing path & Filenames ?
.AttachmentIndex = 0 .AttachmentPosition = 0 .AttachmentPathName = ("c:test1.txt") .AttachmentIndex = 1 .AttachmentPosition = 1 .AttachmentPathName = ("c:test2.txt") .Send True
Note: AttachmentPosition indicates the character position of the attachment in the message body. It is zero-bases, so if your message body is 12 character long (“Hello World.”), available positions are 0 … 11.
Say that you have a list box lstFileNames. You could write a loop to include all list items:
Dim i As Long
With Me.MAPIMessages1
…
For i = 0 To Me.lstFileNames.ListCount – 1
.AttachmentIndex = i
.AttachmentPosition = i
.AttachmentPathName = Me.lstFileNames.List(i)
Next i
.Send True
End With
If you have a multi-select list box and want to include only selected items, you know how to modify this (If Me.lstFileNames.Selected(i) Then …)
(Edited by D Willett on 30-Jan-04 12:43. Resolved, see under break line)
Hans
I changed:
.RecipDisplayName = “JoeBloggs@MyEmail.com”
To:
.RecipDisplayName = “Please Enter E-Mail Address Here”
Which obviously causes an error because the recipient is not known.
I remmed out the line also which created a “Cannot perform action” error.
Is there a way to leave the recipient empty on loading ?
—————————————————————————————————-
How stupid of me, I never saw the ‘.ResolveName property, remmed out, it works fine.
Thanks again.
(Edited by D Willett on 30-Jan-04 12:13. Solution Found, see under break)
Sorry but just another glitch.
I ran the application on a W98 machine and it required the MAPI…ocx to be registered.
Can this be done via code ?
I understand Win2000 & Winxp alreday have this control in the System32 folder ?
Am I correct and these Op systems don’t require the registration ?
—————————————————————————————————————-
Solution found:
Copied RegSvr32 & ocx file to Application Utilities folder.
Then on the splash form, added the following line:
Shell ("L:mmpdfutilitiesregsvr32.exe /s msmapi32.ocx")
(Edited by D Willett on 30-Jan-04 12:13. Solution Found, see under break)
Sorry but just another glitch.
I ran the application on a W98 machine and it required the MAPI…ocx to be registered.
Can this be done via code ?
I understand Win2000 & Winxp alreday have this control in the System32 folder ?
Am I correct and these Op systems don’t require the registration ?
—————————————————————————————————————-
Solution found:
Copied RegSvr32 & ocx file to Application Utilities folder.
Then on the splash form, added the following line:
Shell ("L:mmpdfutilitiesregsvr32.exe /s msmapi32.ocx")
(Edited by D Willett on 30-Jan-04 12:43. Resolved, see under break line)
Hans
I changed:
.RecipDisplayName = “JoeBloggs@MyEmail.com”
To:
.RecipDisplayName = “Please Enter E-Mail Address Here”
Which obviously causes an error because the recipient is not known.
I remmed out the line also which created a “Cannot perform action” error.
Is there a way to leave the recipient empty on loading ?
—————————————————————————————————-
How stupid of me, I never saw the ‘.ResolveName property, remmed out, it works fine.
Thanks again.
Note: AttachmentPosition indicates the character position of the attachment in the message body. It is zero-bases, so if your message body is 12 character long (“Hello World.”), available positions are 0 … 11.
Say that you have a list box lstFileNames. You could write a loop to include all list items:
Dim i As Long
With Me.MAPIMessages1
…
For i = 0 To Me.lstFileNames.ListCount – 1
.AttachmentIndex = i
.AttachmentPosition = i
.AttachmentPathName = Me.lstFileNames.List(i)
Next i
.Send True
End With
If you have a multi-select list box and want to include only selected items, you know how to modify this (If Me.lstFileNames.Selected(i) Then …)
With the Mapi control, the code as below pre-determines the file attachments and, once the Mail application has opened, ie Outlook Express, it is still possible to attach more items using the “Attach” button (Common Dialog) from the program.
With the code below, there are 2 procedures “0” & “1”.
Is it possible to increase these procedures programatically to lets say attch many attachments from a list containing path & Filenames ?
.AttachmentIndex = 0 .AttachmentPosition = 0 .AttachmentPathName = ("c:test1.txt") .AttachmentIndex = 1 .AttachmentPosition = 1 .AttachmentPathName = ("c:test2.txt") .Send True
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.