![]() |
| 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. |
|
|||||||
| Tags: create, file, macro, outlook, show, size |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I would like to create a macro that will show me the folder sizes in outlook
and compare them to another number and then identify if they are above or below that number. This is alot to ask considering I know next to nothing about VBA. is this possible? Any guidence would be wonderful. Thanks. |
| Ads |
|
#2
|
|||
|
|||
|
You can use this sample VBA code which gets the size of the Inbox and use it
for other folders. Otherwise, you can directly get the size of the folder by accessing the PR_MESSAGE_SIZE property by using CDO. Private Sub GetFolderSizes() Dim objOutlook As Outlook.Application Dim objNS As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder, objUnknown As Object Dim lngBytes As Long, intX As Integer Set objOutlook = New Outlook.Application Set objNS = objOutlook.GetNamespace("MAPI") Set objFolder = objNS.GetDefaultFolder(olFolderInbox) For intX = 1 To objFolder.Items.Count lngBytes = lngBytes + objFolder.Items.Item(intX).Size Next MsgBox "Folder size is " & lngBytes & " bytes." End Sub -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "john mcmichael" wrote: I would like to create a macro that will show me the folder sizes in outlook and compare them to another number and then identify if they are above or below that number. This is alot to ask considering I know next to nothing about VBA. is this possible? Any guidence would be wonderful. Thanks. |
|
#3
|
|||
|
|||
|
I have copied this and placed it into the VBE. When I try to run it, I get a
complie error. Abiguous name detected: Get folderSizes. I'm not sure where to go with this. Please advise and thanks for the help. I cant tell you how much this helps me. While we are at it...I know how to create macros and assign them to buttons in Excel, but while I can create a button in Outlook, I cant assign a macro to it. Can this be done in Outlook? Thanks again and have a great day. "Eric Legault [MVP - Outlook]" wrote: You can use this sample VBA code which gets the size of the Inbox and use it for other folders. Otherwise, you can directly get the size of the folder by accessing the PR_MESSAGE_SIZE property by using CDO. Private Sub GetFolderSizes() Dim objOutlook As Outlook.Application Dim objNS As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder, objUnknown As Object Dim lngBytes As Long, intX As Integer Set objOutlook = New Outlook.Application Set objNS = objOutlook.GetNamespace("MAPI") Set objFolder = objNS.GetDefaultFolder(olFolderInbox) For intX = 1 To objFolder.Items.Count lngBytes = lngBytes + objFolder.Items.Item(intX).Size Next MsgBox "Folder size is " & lngBytes & " bytes." End Sub -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "john mcmichael" wrote: I would like to create a macro that will show me the folder sizes in outlook and compare them to another number and then identify if they are above or below that number. This is alot to ask considering I know next to nothing about VBA. is this possible? Any guidence would be wonderful. Thanks. |
|
#4
|
|||
|
|||
|
That error is most likely due to a second procedure with an identical name;
search your project and rename or comment out the other one. To map a macro to a custom button, enter toolbar Customize mode and select the Macro from the list of Commands after you select Macros in the Categories list under the Commands tab. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "john mcmichael" wrote: I have copied this and placed it into the VBE. When I try to run it, I get a complie error. Abiguous name detected: Get folderSizes. I'm not sure where to go with this. Please advise and thanks for the help. I cant tell you how much this helps me. While we are at it...I know how to create macros and assign them to buttons in Excel, but while I can create a button in Outlook, I cant assign a macro to it. Can this be done in Outlook? Thanks again and have a great day. "Eric Legault [MVP - Outlook]" wrote: You can use this sample VBA code which gets the size of the Inbox and use it for other folders. Otherwise, you can directly get the size of the folder by accessing the PR_MESSAGE_SIZE property by using CDO. Private Sub GetFolderSizes() Dim objOutlook As Outlook.Application Dim objNS As Outlook.NameSpace Dim objFolder As Outlook.MAPIFolder, objUnknown As Object Dim lngBytes As Long, intX As Integer Set objOutlook = New Outlook.Application Set objNS = objOutlook.GetNamespace("MAPI") Set objFolder = objNS.GetDefaultFolder(olFolderInbox) For intX = 1 To objFolder.Items.Count lngBytes = lngBytes + objFolder.Items.Item(intX).Size Next MsgBox "Folder size is " & lngBytes & " bytes." End Sub -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "john mcmichael" wrote: I would like to create a macro that will show me the folder sizes in outlook and compare them to another number and then identify if they are above or below that number. This is alot to ask considering I know next to nothing about VBA. is this possible? Any guidence would be wonderful. Thanks. |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Calendar file size | kaffelatte | Outlook - Calandaring | 6 | May 2nd 06 05:34 PM |
| Excel macro to create e-mail in Outlook Web Access | fitful_thought | Outlook - General Queries | 0 | April 15th 06 11:23 AM |
| Macro to create repeating calender event/meeting | Graham | Outlook and VBA | 4 | March 18th 06 07:49 PM |
| I want to change the size of my calendar to show more items | John at ghost walk | Outlook - Calandaring | 0 | February 25th 06 05:25 PM |
| Create a macro that runs from a Rule | CF_business_analyst | Outlook and VBA | 8 | January 13th 06 06:12 PM |