|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Can Outlook.Application be used to control open message windows?We have a VFP 8 CRM application which - amongst other things - stores links for any client to any document relating to them on our file server. When you go into a client record you can see instantly if there are any documents on file relating to them and it is straight forward to add a new file to a record if we received something via email for instance. The physical location of the file is not too important to our users as they simply double click any file they want to view and the file is executed in the shell object to open it's associated viewer. The problem I am currently trying to solve is when a user wants to attach one or more files relating to a client to an email. Currently they have to manually create the email and more irritatingly they then have manually navigate to all the files they want to attach. What I would like to be code would be some way for the user to initially create the email as usual and then, from the client record on the application, select the files they want to send and click a button which some how attaches the files from their various locations into the email the user has created. I thought an easy way to do this would be to access some kind of object collection in the Outlook.Application model to provide the user with a list of the open email windows and their subjects which should enable the user which window / message they want their files attached to. However I cannot find any way of accessing anything other than the main outlook window. Does anyone have any ideas how this could be achieved? Thanks in advance!! Phil H p***@wrltd.co.uk This is more of an Outlook question than Exchange, but if you're looking to
get a list of open email items, you have to loop through the Inspectors collection: Dim myInspectors As Outlook.Inspectors Dim myInspector As Outlook.Inspector For Each myInspector in myInspectors Set myMail = myInspector.CurrentItem For i = 1 to myMail.Attachments.Count msgBox myMail.Attachments.Item(1).FileName Next Set myMail = Nothing Next Set myInspector = Nothing Set myInspectors = Nothing This shows how to enumerate through the open inspectors, of coarse you'd have to modify the code to do something like populate a listbox with the items or process them in some way. John Show quoteHide quote "Phil Hollingworth" <p***@wrltd.co.uk> wrote in message news:41bd9f71$0$16588$cc9e4d1f@news-text.dial.pipex.com... > Hi > > We have a VFP 8 CRM application which - amongst other things - stores > links > for any client to any document relating to them on our file server. When > you > go into a client record you can see instantly if there are any documents > on > file relating to them and it is straight forward to add a new file to a > record if we received something via email for instance. > > The physical location of the file is not too important to our users as > they > simply double click any file they want to view and the file is executed in > the shell object to open it's associated viewer. > > The problem I am currently trying to solve is when a user wants to attach > one or more files relating to a client to an email. Currently they have to > manually create the email and more irritatingly they then have manually > navigate to all the files they want to attach. > > What I would like to be code would be some way for the user to initially > create the email as usual and then, from the client record on the > application, select the files they want to send and click a button which > some how attaches the files from their various locations into the email > the > user has created. > > I thought an easy way to do this would be to access some kind of object > collection in the Outlook.Application model to provide the user with a > list > of the open email windows and their subjects which should enable the user > which window / message they want their files attached to. > > However I cannot find any way of accessing anything other than the main > outlook window. > > Does anyone have any ideas how this could be achieved? > > Thanks in advance!! > > Phil H > p***@wrltd.co.uk > > > > Hi John
Thanks for your response. Your suggestion did work and I was able to access the Inspectors collection to identify all the open email windows. However, I was unable to get full access to these windows to insert attachments. Any other suggestions? Kind regards Phil H. p***@wrltd.co.uk Show quoteHide quote "John Riddle" <jriddleatsignwilsongroupnyperiodcom> wrote in message news:#DF2QkS4EHA.3504@TK2MSFTNGP12.phx.gbl... > This is more of an Outlook question than Exchange, but if you're looking to > get a list of open email items, you have to loop through the Inspectors > collection: > > Dim myInspectors As Outlook.Inspectors > Dim myInspector As Outlook.Inspector > > For Each myInspector in myInspectors > Set myMail = myInspector.CurrentItem > For i = 1 to myMail.Attachments.Count > msgBox myMail.Attachments.Item(1).FileName > Next > Set myMail = Nothing > Next > Set myInspector = Nothing > Set myInspectors = Nothing > > This shows how to enumerate through the open inspectors, of coarse you'd > have to modify the code to do something like populate a listbox with the > items or process them in some way. > > John > Each Inspector has a CurrentItem property. That is what would have an
Attachments collection: Dim oMail As Outlook.MailItem Dim colAttach As Outlook.Attachments Set oMail = oInspector.CurrentItem Set colAttach = oMail.Attachments -- Show quoteHide quoteKen Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Phil Hollingworth" <p***@wrltd.co.uk> wrote in message news:41bec2bf$0$16588$cc9e4d1f@news-text.dial.pipex.com... > Hi John > > Thanks for your response. > > Your suggestion did work and I was able to access the Inspectors collection > to identify all the open email windows. However, I was unable to get full > access to these windows to insert attachments. > > Any other suggestions? > > Kind regards > > Phil H. > p***@wrltd.co.uk Ken
You are a star - thanks very much! Kind regards Phil H. Show quoteHide quote "Ken Slovak - [MVP - Outlook]" <kenslo***@mvps.org> wrote in message news:#CWX0Xe4EHA.1072@TK2MSFTNGP09.phx.gbl... > Each Inspector has a CurrentItem property. That is what would have an > Attachments collection: > > Dim oMail As Outlook.MailItem > Dim colAttach As Outlook.Attachments > > Set oMail = oInspector.CurrentItem > Set colAttach = oMail.Attachments > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com > Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 > Reminder Manager, Extended Reminders, Attachment Options > http://www.slovaktech.com/products.htm >
Run time error 430 with late binding Outlook 2003
Controlling Outlook from Word VBA - PROBLEM... Win32 API Timer - crash Reading Read Receipts in Outlook SentOnBehalfOfName property does not take effect - Help! Trying to get to ContactItem from items on DistListItem (office xp) Background Process Outlook VBA - Need to grab SMTP address, not Contact Name Late Binding to Outlook from Excel: Outlook modifies email body How to copy a unique string public folder message to a local messa |
|||||||||||||||||||||||