Here's a small macro that some of you may find useful. We have several databases that contain data that is sent to somebody by e-mail. I've made macros for all users to do this, so that they automatically use the right format and do not send the entire database instead of a single record.
Most people want to pick a name from a list and hit OK instead of typing the address.
The following macro takes care of that. First, it presents the user with an inputbox to type in the address. If no address is entered, the macro shows the content of a folder. This folder (in this case a subfolder of "F:\Cardbox3" called "Email") contains text files without the ".txt" extension. Each filename is a name, such as "John" or "Mary" or whatever. So, what the users sees is a list of names. When such a file is clicked, the macro reads the contents of that file, which is a single line that constitutes the actual e-mail address.
E.g. the file "John" may contain the line "email@example.com".
Please note that:
You don't need the inputbox. If you ALWAYS want to pick a name, remove the inputbox line as well as the IF-statement.
You may also make files that have the name of an entire group of people. Such a file could contain more than a single address. Use the SPLIT command to send an e-mail to everyone in that file.
Here's the macro:
addressee=InputBox("E-mail to whom?" & vbCrLf & "Or click OK immediately to pick a name.", "Enter the e-mail address.")
if addressee="" then
name=GetOpenFilename("","F:\cardbox3\Email","Pick a name.")
FOLLOWED BY THE LINES THAT SEND THE EMAIL, USING THE VARIABLE "ADDRESSEE"