I don't think a listbox is a very good UI choice here.
Further, it not clear if you want the user to select a bunch of names..then
whack merge..and have all the documents made, or you want to do one at a
time?
If you want to do one at a time..then why bother with a multi-select? Just
have the user navigate to the name on a form how they do now (I sure you
have
provided a nice way to search and bring up a particular student to edit as
this
would be perhaps the most common task. In other words, to do anything
with a student..you have to search, and then view that student in a form
anyway. Once you train your users to search, and find a
student...then a simple merge button on the form to complete the task would
make the most sense, and requite less training to your users.
Here is some ideas on searching:
http://www.attcanada.net/~kallal.msn/Search/index.html
The way you have your listbox select code now is you let the user select a
bunch of names..and the for each on you prompt the user if you want to make
a word doc. I see that you also need to prompt for the "reason".
If the user clicks on 10 names..and then after a few letters..the user
might have the phone ring..and need to lookup something else. Now, how is
the
user to get out of your prompt loop and do something else? How will they
re-start the task back into the middle of the list? What happens if the
word doc freezes up. There is many things that can go wrong here
and your users will need some means to work through these problems
I think that UI approach is going to cause some frustration. Further, right
after the msgbox is answered...the code will loop around right around back
to that msgbox.
(it will NOT wait for the rest of the code).
Even more important here is that you are also trying to email the word
document also.
So, you are using quite a few technologies here. You are not just perform a
simple
word merge..but also then want to be able to email this document. So, you
are
throwing a lot of complexity to the user all at once. Again, for this
reason, I
would probably break this down in to doing this one at a time, or all at a
time WITHOUT any user prompts. In other words, go and edit
each student, set the reasons, and perhaps have a check box to
send a email to. Then make a process that runs the whole thing.
Or, go to each student, and have a email button..but do it one
at a time. But some prompts right in the middle of a
process is not very workable.
Further, to use sendobject, you can't use a word merge. Send object will
allow you to send a report to rtf, file and then have it attached to a
email. But you can't accomplish a word merge..and THEN attach the word doc
using sendobject.
So, my word merge will create the word document for you..but it will not
attached it to a email. There are two reasonable solutions here:
1) use a report that looks like the letter, and then you can use sendoubect.
2) Use my code to make the word doc, then use Microsoft Outlook..and NOT
outlook express. If you do that..then you can create the word document...and
then attach this document as a email. Again, it is not clear if the word
document needs to be edited in anyway before it gets attached as email. And,
also, again it is not clear if the email text needs editing here also.
So, are you trying to make a word merge....and attached as email...or is the
word merge just good enough here?