Option Explicit Sub writemyproperties() 'This macro exports all the built-in and custom project properties 'to a text file. It lists the index of the property, the name and the value. 'It demonstrates the use of a simple error handler to skip the errors that 'occur when a property is not defined or used. 'Copyright Jack Dahlgren, Feb 2002 Dim MyString, MyFile As String Dim fnum, myIndex As Integer Dim myProj As Project Dim skipme As Boolean 'set location and name of file to be written MyFile = "c:\" & ActiveProject.Name & "_properties.txt" skipme = False 'set and open file for output fnum = FreeFile() Open MyFile For Output As fnum 'write project info and then a blank line Write #fnum, "Built In Properties" Write #fnum, myIndex = 1 Set myProj = ActiveProject While myIndex <= myProj.BuiltinDocumentProperties.Count On Error GoTo ErrorHandler MyString = (myIndex & ") " & myProj.BuiltinDocumentProperties(myIndex).Name & ": " & myProj.BuiltinDocumentProperties(myIndex).Value) If Not skipme Then Write #fnum, MyString End If myIndex = myIndex + 1 skipme = False Wend Write #fnum, "-----------------------------------------------" Write #fnum, Write #fnum, "Custom Properties" Write #fnum, myIndex = 1 While myIndex <= myProj.CustomDocumentProperties.Count On Error GoTo ErrorHandler If Not skipme Then MyString = (myIndex & ") " & myProj.CustomDocumentProperties(myIndex).Name & ": " & myProj.CustomDocumentProperties(myIndex).Value) Write #fnum, MyString End If myIndex = myIndex + 1 skipme = False Wend Close #fnum ErrorHandler: skipme = True Resume Next End Sub