Smart Tool to export mail files size to an Excel file


Dim db As NotesDatabase
	Dim mailpos As Integer
	Dim found As Integer
	Dim servername As String
	Dim mailpath As String
	Dim mailowner As String
	Dim inotesdoc As NotesDocument
	Dim view As NotesView
	Dim xlFilename As String
	Dim Excel As Variant
	Dim xlWorkbook As Variant
	Dim xlSheet As Variant
	Dim object As NotesEmbeddedObject
	Dim i As Integer
	xlFilename = "C:\dbsize.xls"
	Set Excel = CreateObject( "Excel.Application" )
	Excel.Visible = True
	Excel.Workbooks.Open xlFilename
	Set xlWorkbook = Excel.ActiveWorkbook
	Set xlSheet = xlWorkbook.ActiveSheet
	Dim cellval As String
	Dim item As NotesItem
	Dim profilecollection As NotesDocumentCollection
	Dim doc1 As NotesDocument


	'Mail subdirectory name
	mailpath = "mail\"
	'Server name (in canonical format  e.g  CN=Servername/O=Acme):
	servername = "xxxxxx/xxxx"

	Dim dbdir As New NotesDbDirectory(servername)
	'Cycle through mail databases on the server
	Set db = dbdir.GetFirstDatabase(DATABASE)
	i=1
	While Not db Is Nothing

		On Error Resume Next
		'Check to see if this database is in the mail directory
		mailpos = InStr(db.FilePath, mailpath)
		If mailpos = 1 Then
			Call db.Open(servername, db.FilePath)
			xlsheet.Cells(i,1).value=db.title
			
			xlsheet.Cells(i,2).value=db.size
			
			i=i+1
		End If
		
		Set db = dbdir.GetNextDatabase()
	Wend
	Exit Sub
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
1 comment(s)Login first to comment...
Craig Fogus
(at 11:18 on 23.08.2017)
First, thanks for this code. Second, I'm getting this error on the "On Error Resume Next" Statement is illegal outside of a subprogram. Any ideas? Thanks!