Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2012, 10:42 PM
HxG HxG is offline outlook vba code help Windows 7 32bit outlook vba code help Office 2010 32bit
Novice
outlook vba code help
 
Join Date: Sep 2012
Posts: 2
HxG is on a distinguished road
Default outlook vba code help

hi,


I have this code for my outlook vba:
Code:
 Option Explicit
Sub test()
Dim oDict As Scripting.Dictionary
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim olItem As Object
Dim arrData() As Variant
Dim CategoryCnt As Integer
Dim c As Long

Set oDict = New Scripting.Dictionary

Set olApp = New Outlook.Application

Set olNS = olApp.GetNamespace("MAPI")

Set olFolder = olNS.GetDefaultFolder(olFolderInbox)

CategoryCnt = olNS.Categories.Count

ReDim arrData(1 To 2, 1 To CategoryCnt)

c = 0
For Each olItem In olFolder.Items
If Not oDict.Exists(olItem.Categories) Then
c = c + 1
arrData(1, c) = olItem.Categories
arrData(2, c) = 1
oDict.Add olItem.Categories, c
Else
arrData(2, oDict.Item(olItem.Categories)) = arrData(2, oDict.Item(olItem.Categories)) + 1
End If
Next olItem

ReDim Preserve arrData(1 To 2, 1 To c)

Range("A2").Resize(UBound(arrData, 2), UBound(arrData, 1)).Value = Application.Transpose(arrData)

End Sub
But it is giving me a compile error on the last code: Range("A2").Resize(UBound(arrData, 2), UBound(arrData, 1)).Value = Application.Transpose(arrData)
How can I correct this?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
bar code list msheyworth Excel 2 08-26-2012 01:10 PM
outlook vba code help Where does my code go? rbaldwin Word VBA 3 03-14-2012 02:31 PM
Help with VBA Code Modification OTPM Excel Programming 0 09-16-2011 07:10 AM
outlook vba code help vbc code rajpeter Excel Programming 2 09-13-2011 02:29 PM
Writing code with C# and VB.NET to create Outlook add-ins and other projects kistou Outlook 0 01-13-2010 04:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft