A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Default folder to Public folder when Exporting outlook form data toexcel



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 10th 08, 09:25 PM posted to microsoft.public.outlook
Cass
external usenet poster
 
Posts: 31
Default Default folder to Public folder when Exporting outlook form data toexcel

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"......
...............
Ads
  #2  
Old January 11th 08, 01:33 PM posted to microsoft.public.outlook
Brian Tillman
external usenet poster
 
Posts: 17,452
Default Default folder to Public folder when Exporting outlook form data to excel

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
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Public Folder Calendar ralphdevlin via OfficeKB.com Outlook - Using Forms 0 November 27th 07 06: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 01:48 AM
Exporting contacts from public folder mo Outlook - Using Contacts 2 April 12th 06 08:41 AM


All times are GMT +1. The time now is 12:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.