![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I am trying to get a code for exporting data from an outlook form to
default to export a certain folder. I keep getting the Object Could not be found error. When I try it with my personal folders it work but when i try it with the public I can't get it to work. Is it set up wrong for public folder selection? Please help I get the error on " Set olTest = olFolder.Folders("Test Folder")" Heres the code... Sub Auto_Open() Dim olApp As Outlook.Application Dim olNamespace As Outlook.Namespace Dim olFolder As Outlook.MAPIFolder Dim olTest As Outlook.MAPIFolder Dim olColItems As Outlook.Items Dim olItem As Object Dim strDummy As String Dim wbBook As Workbook Dim wsSheet As Worksheet Dim i As Long Application.ScreenUpdating = False 'Instantiate the MS Outlook objects. Set olApp = Outlook.Application Set olNamespace = olApp.GetNamespace("MAPI") Set olFolder = olNamespace.Folders("Public Folders") Set olTest = olFolder.Folders("Test Folder") If olFolder Is Nothing Then GoTo ExitSub ElseIf olFolder.DefaultItemType olContactItem Then MsgBox "The selected folder does not contain contacts.", vbOKOnly GoTo ExitSub ElseIf olFolder.Items.Count = 0 Then MsgBox "No contacts to import.", vbOKOnly GoTo ExitSub End If Set wbBook = ThisWorkbook Set wsSheet = wbBook.Worksheets(1) 'Prepare the targeting worksheet. With wsSheet .Range("A1").CurrentRegion.Clear Cells(1, 1).Value = "Utility" Cells(1, 2).Value = "City, State & Zip" Cells(1, 3).Value = "Main Contact" Cells(1, 4).Value = "Main Phone Number" Cells(1, 5).Value = "Email Address" Cells(1, 6).Value = "Fax Number" Cells(1, 7).Value = "Alternate Contact 1" Cells(1, 8).Value = "Alternate Phone Number 1"...... ............... |
#2
|
|||
|
|||
![]()
Cass wrote:
I am trying to get a code for exporting data from an outlook form to default to export a certain folder. Code questions go in the programming group: microsoft.public.outlook.program_vba -- Brian Tillman [MVP-Outlook] |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exporting Public Folder Calendar | ralphdevlin via OfficeKB.com | Outlook - Using Forms | 0 | November 27th 07 05:52 PM |
exporting contacts in public folder? | Rudy | Outlook - Using Contacts | 1 | September 6th 07 07:10 PM |
Default form in Public Calendar folder | Sylvia[_2_] | Outlook - General Queries | 1 | July 24th 07 01:58 PM |
Message Class form as default in Public Folder | Dino | Outlook - Using Forms | 3 | January 30th 07 12:48 AM |
Exporting contacts from public folder | mo | Outlook - Using Contacts | 2 | April 12th 06 08:41 AM |