create macro to show file size in outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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.
 
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/
 
Back
Top