Detecting if a Template is Currently Open

T

Thomas M

Outlook 2000

I have a macro that opens an Outlook template and attaches a file.
Sometimes, I'll send the message with just one attachment, but other
times I need to add multiple attachments. When I do need to add multiple
attachments, rather than have the code open another copy of the template,
I'd like to have it just activate the copy that is already open.

How can I make the code detect when the template is already open, and how
would I then activate that template and add another attachment?

--Tom
 
M

Michael Bauer

Hi Thomas,

you need a property that indicates the template. If it is a draft item
then you can use the EntryID, or maybe you add an UserProperty to the
template with a specific keyword.
 
T

Thomas M

Hi Thomas,

you need a property that indicates the template. If it is a draft item
then you can use the EntryID, or maybe you add an UserProperty to the
template with a specific keyword.

Thanks for the reply. I looked at both of these options, and I don't see
how I can use them to accomplish the goal. What I'm trying to do is
identify when the template is already open (so it doesn't get opened
again). I was hoping that there would be a way to cycle through all the
open messages, and key off the Subject of the message to determine if the
template is open.

Interestingly, I can make this work if Outlook is configured to use Word
as the email editor. In that situation, the following code works:

For Counter = 1 to Documents.Count
MsgBox Documents.Item(Counter).Name
Next

Of course, the code would need to do something when it found the right
name. Unfortunately, I can't rely on having Outlook configured to use
Word as the email editor. So I need to find a way in Outlook VBA to do
the same basic thing as shown above.

Any ideas?

--Tom
 
Top