PC Review


Reply
Thread Tools Rate Thread

Attachment Dialog in Macro

 
 
Mangus Pyke
Guest
Posts: n/a
 
      24th Jul 2005
I'm send an identical email with a different attachment to eight
groups of team managers on a monthly basis. The subject line changes
each month (to include the appropriate month) and the recipients
differ in each email. To simplify my life, I made a macro for each
client that looks like this:

Sub AcmeClient()
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(olMailItem)
With myitem
..Recipients.Add ("Smith, Joe; Roberts, Bob")
Set tocontact = .Recipients.Add("Anderson, Joe")
tocontact.Type = olCC
..Subject = "Monthly Audit Report: " & Format(Date - 20, "mmmm yyyy")
Chr(13) & Chr(13) & "Please contact me if you have questions or need
more information."
..Importance = 2
End With
myitem.Display
Call InsertSig("Monthly")
Set myolapp = Nothing
Set myitem = Nothing
End Sub

This provides me with an email addressed to the correct people, with
the standard subject line and the appropriate month, and inserts a
signature that is composed of [a] two lines of text (i.e. call me if
you have question, etc) and [b] my regular signature, which gets me
around the issues I had with dropping a pre-defined text and a
signature into the email (they were wiping each other out, so I would
end up with only a signature).

The only thing left that I want to do is spawn a dialog box to add the
file attachment that goes with the email, but I've had no luck in
figuring out that part. I'm used to the object model for Excel, but
I'm completely out of my element with Outlook.

Any suggestions?

MP-
--
"Learning is a behavior that results from consequences."
B.F. Skinner
 
Reply With Quote
 
 
 
 
Michael Bednarek
Guest
Posts: n/a
 
      24th Jul 2005
On Sat, 23 Jul 2005 20:32:29 -0400, Mangus Pyke <(E-Mail Removed)>
wrote in microsoft.public.outlook.program_vba:

>I'm send an identical email with a different attachment to eight
>groups of team managers on a monthly basis. The subject line changes
>each month (to include the appropriate month) and the recipients
>differ in each email. To simplify my life, I made a macro for each
>client that looks like this:

[snip]
>The only thing left that I want to do is spawn a dialog box to add the
>file attachment that goes with the email, but I've had no luck in
>figuring out that part. I'm used to the object model for Excel, but
>I'm completely out of my element with Outlook.
>
>Any suggestions?


If the macro knows the location of the attachment:
myItem.Attachments.Add(Source, Type, Position, DisplayName)

or by executing the menu item:
ActiveInspector.CommandBars("Menu Bar").Controls("Insert").CommandBar.Controls("&File...").Execute
or shorter (and presumably language independent):
ActiveInspector.CommandBars.FindControl(,1079).Execute

See also: <http://www.outlookcode.com/d/tips/commandbarfun.htm>.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Mangus Pyke
Guest
Posts: n/a
 
      24th Jul 2005
On Sun, 24 Jul 2005 21:46:56 +1000, Michael Bednarek wrote:
>On Sat, 23 Jul 2005 20:32:29 -0400, Mangus Pyke
>wrote in microsoft.public.outlook.program_vba:
>>The only thing left that I want to do is spawn a dialog box to add the
>>file attachment that goes with the email, but I've had no luck in
>>figuring out that part. I'm used to the object model for Excel, but
>>I'm completely out of my element with Outlook.

>
>If the macro knows the location of the attachment:
> myItem.Attachments.Add(Source, Type, Position, DisplayName)
>
>or by executing the menu item:
> ActiveInspector.CommandBars("Menu Bar").Controls("Insert").CommandBar.Controls("&File...").Execute
>or shorter (and presumably language independent):
> ActiveInspector.CommandBars.FindControl(,1079).Execute


Michael:

Thank you so much! I fought with this all day Thursday and Friday
trying everything I could find on the web, but to no avail!

I was completely off-target and not at all familiar with CommandBar.

Thank you for both the solution and the link so I can learn more!

MP-
--
"Learning is a behavior that results from consequences."
B.F. Skinner
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
attachment dialog box =?Utf-8?B?YWJpbGVuZWtvbmFyaw==?= Microsoft Outlook Discussion 1 9th Jun 2005 12:05 AM
Attachment Dialog Box Mike Microsoft Outlook Discussion 0 30th May 2005 03:09 PM
save attachment dialog box Roady [MVP] Microsoft Outlook 1 27th Jul 2004 03:19 PM
control of dialog macro dialog box. on open Gerry Abbott Microsoft Excel Programming 0 22nd Jul 2004 05:41 PM
Attachment Dialog Problem C. Andrew Dunning Microsoft Outlook 0 18th Mar 2004 06:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:43 PM.