Darryl Collins
Darryl.Collins at iag.com.au
Mon Nov 8 16:43:28 CST 2010
_______________________________________________________________________________________ Note: This e-mail is subject to the disclaimer contained at the bottom of this message. _______________________________________________________________________________________ Thanks Rocky, That is going to come in handy one day. Cheers Darryl -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin Sent: Tuesday, 9 November 2010 4:40 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] FW: Getting Outlook Folder in VBA ________________________________ From: Rocky Smolin [mailto:rockysmolin at bchacc.com] Sent: Monday, November 08, 2010 9:12 AM To: 'Access Developers discussion and problem solving' Subject: FW: Getting Outlook Folder in VBA Reply from Helen Feddema regarding my inquiry about the Outlook Object. Rocky ________________________________ From: Helen Feddema [mailto:hfeddema at hvc.rr.com] Sent: Monday, November 08, 2010 9:00 AM To: 'Rocky Smolin' Subject: RE: Getting Outlook Folder in VBA The Outlook object model is indeed obscure and difficult to understand. See my Access Archon #67 article on it (from a few Office versions back, but still useful). Access Archon #102 shows how to store Outlook mail messages in an Access table. Also, my two most recent books have examples of exporting Access data to Outlook, or importing Outlook data into Access. http://www.helenfeddema.com/Files/accarch67.zip http://www.helenfeddema.com/Files/accarch102.zip Also check out the Code Samples page on my Website for a number of code samples dealing with Outlook: http://www.helenfeddema.com/CodeSamples.htm Here is info on the books: Access 2007 book Title: AccessT 2007 VBA Bible For Data-Centric Microsoft Applications Author: Helen Feddema Publisher: Wiley Publication Year: 2007 ISBN: 047004702X Description: As long-time AW readers know, data exchange among Office applications has always been one of my main interests, and that is the topic of this book. It covers using Access 2007 for data storage, entering, editing and printing data where Access does the job best, and exporting data to other Office applications (Word, Excel and Outlook) where they are best. One of the sample databases for this book finally achieves a long-time goal of mine: two-way synchronizing of Outlook and Access contacts, where the contact information is stored in a set of properly normalized, linked tables in Access. This lets you store all the information you need (or want) to store in Access tables - say, 30 phone numbers for Microsoft, or five addresses for a wealthy friend - while using the convenient and attractive Outlook interface to work with contacts. You can add or edit contact data in Access or Outlook, and synchronize contacts as needed (for those fields that are supported in Outlook), which gives you the best of both applications. The book also covers writing add-ins of several types (Access, VB 6, and Visual Studio), with tips on how to get them to work in Vista (more info on this topic was presented in Access Archon #162, based on information I got after the book went to press). Amazon link: http://www.amazon.com/exec/obidos/ISBN=047004702X/helenfeddemaswebA Access application development book Title: Expert One-on-One Microsoft Access Application Development Author: Helen Feddema Publisher: Wiley Publication Year: 2004 ISBN: 0-7645-5904-4 Description: This book is written for experienced Access users, who know how to create tables, queries, forms and other Access objects, and have some familiarity with writing Access VBA code, but need help in making the transition from an experienced and competent Access user who can create databases for personal use, to an Access developer who can make a living developing applications for clients. The book concentrates on this book writing VBA code to connect the components of a database into a functioning, coherent application. Amazon link: http://www.amazon.com/exec/obidos/ISBN=0764559044/helenfeddemaswebA ________________________________ From: Rocky Smolin [mailto:rockysmolin at bchacc.com] Sent: Monday, November 08, 2010 11:53 AM To: 'Helen Feddema' Subject: RE: Getting Outlook Folder in VBA Dear Ms. Feddema: Thank you so much for your prompt response. It was exactly what I needed and was able to effect the solution for my client in just a couple of minutes. And I agree with your opinion about storing the path so that it can be changed when the folder moves or if the app is installed on another machine where the name and/or path might be different. I'm recommending to my client that this enhancement be implemented in his system. Even on AccessD where there are some very Access knowledgeable people, the Outlook object model seems to be obscure. Do you know of a resource that would explain the model that I could pass to the group? Thanks again. With best regards, Rocky Smolin Beach Access Software 858-259-4334 Skype: rocky.smolin www.e-z-mrp.com <http://www.e-z-mrp.com/> www.bchacc.com <http://www.bchacc.com/> ________________________________ From: Helen Feddema [mailto:hfeddema at hvc.rr.com] Sent: Sunday, November 07, 2010 9:23 AM To: 'Rocky Smolin' Subject: RE: Getting Outlook Folder in VBA I am attaching a document with the syntax for referencing Outlook folders in various locations. However, there is another method you can use in this case, since (as I am sure you are aware, even if the client isn't) that it is not a good idea to hard-code paths. You can put an Outlook path selector on the main menu, using the PickFolder method to store the selected Outlook folder in a custom database property, and then retrieve it for use in code. That way, if the path needs to be changed at some point, it can be done by just selecting another folder on the main menu. See Access Archon #185 (attached) for a description of this method. ________________________________ From: Rocky Smolin [mailto:rockysmolin at bchacc.com] Sent: Sunday, November 07, 2010 10:08 AM To: hfeddema at hvc.rr.com Subject: Getting Outlook Folder in VBA Dear Ms. Feddema: I am trying to transfer data from an Access table to an Outlook contacts folder. I visited your site and was using one of your samples as a guide was able to do this. But then the client wanted to hard code the contact folder instead of using the .PickFolder method, but I cannot seem to get the syntax right to do this. I'm using: Dim olFolder As Outlook.MAPIFolder Dim olApplication As Outlook.Application Dim olNameSpace As Outlook.NameSpace Set olApplication = CreateObject("Outlook.Application") Set olNameSpace = olApplication.GetNamespace("MAPI") Set olFolder = olNameSpace.Folders("DocketWorks") The last line generates the error "The operation failed. An object could not be found." I tried the code posted at http://msdn.microsoft.com/en-us/library/bb177014%28v=office.12%29.aspx which seemed like an overly elaborate way to get the folder object set, but it also failed with the same error when setting the folder although another member of the AccessD list is using it successfully. So there's something amiss in my app. I would be grateful for any ideas you have to resolve this. Is there a syntax to set the folder object to a specific folder? the folder named "DocketWorks" is a sub folder to Contacts, and , ,as I say, using your .PickFolder method I can set the folder object and transfer the contacts. Many thanks in advance, Rocky Smolin Beach Access Software 858-259-4334 Skype: rocky.smolin www.e-z-mrp.com <http://www.e-z-mrp.com/> www.bchacc.com <http://www.bchacc.com/> -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________________________________________________ The information transmitted in this message and its attachments (if any) is intended only for the person or entity to which it is addressed. The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information, by persons or entities other than the intended recipient is prohibited. If you have received this in error, please contact the sender and delete this e-mail and associated material from any computer. The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files, with the permission of the sender. This message has been scanned for viruses. _______________________________________________________________________________________