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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , ,

create macro to show file size in outlook





 
 
Thread Tools Display Modes
  #1  
Old May 2nd 06, 06:49 PM posted to microsoft.public.outlook.program_vba
john mcmichael
external usenet poster
 
Posts: 3
Default create macro to show file size in outlook

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  
Old May 2nd 06, 10:13 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default create macro to show file size in outlook

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  
Old May 2nd 06, 10:42 PM posted to microsoft.public.outlook.program_vba
john mcmichael
external usenet poster
 
Posts: 3
Default create macro to show file size in outlook

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  
Old May 2nd 06, 10:55 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 817
Default create macro to show file size in outlook

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

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
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


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgages - Discuss TV Forums - Classic Cars - Credit Cards UK - Loans