Hello khindaria,
I'm glad Jack's macro was able to get you part way. To your
comments.
a) I believe the "blank row" you are seeing inserted is designed for
the assignment information on the task. If you have no resources
assigned, the row will be blank. You should be able to comment out
those lines or delete them. -- I've removed the lines in the
modified code below
b) I've modified Jack's code to remove the assignments information
and capture the task start and finish. I've copied the code below.
If you copy and paste be careful of any extraneous characters.
Obviously, test on a copy of your file.
==============================================
'This module contains macros which will export
'tasks to excel and keep the task hierarchy.
'modify as necessary to include other task information
'Copyright Jack Dahlgren, Feb 2002
Option Explicit
Dim xlRow As Excel.Range
Dim xlCol As Excel.Range
Sub TaskHierarchy()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim Proj As Project
Dim t As Task
Dim ColumnCount As Integer
Dim Columns As Integer
Dim Tcount As Integer
Set xlApp = New Excel.Application
xlApp.Visible = True
AppActivate "Microsoft Excel"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Name = ActiveProject.Name
'count columns needed
ColumnCount = 0
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.OutlineLevel > ColumnCount Then
ColumnCount = t.OutlineLevel
End If
End If
Next t
'Set Range to write to first cell
Set xlRow = xlApp.ActiveCell
xlRow = "Filename: " & ActiveProject.Name
dwn 1
xlRow = "OutlineLevel"
dwn 1
'label Columns
For Columns = 1 To (ColumnCount + 1)
Set xlCol = xlRow.Offset(0, Columns - 1)
xlCol = Columns - 1
Next Columns
rgt 2
xlCol = "Start Date"
rgt 1
xlCol = "Finish Date"
Tcount = 0
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
dwn 1
Set xlCol = xlRow.Offset(0, t.OutlineLevel)
xlCol = t.Name
If t.Summary Then
xlCol.Font.Bold = True
End If
Set xlCol = xlRow.Offset(0, Columns)
xlCol = t.Start ' capture task start
rgt 1
xlCol = t.Finish ' capture task finish
Tcount = Tcount + 1
End If
Next t
AppActivate "Microsoft Project"
MsgBox ("Macro Complete with " & Tcount & " Tasks Written")
End Sub
Sub dwn(i As Integer)
Set xlRow = xlRow.Offset(i, 0)
End Sub
Sub rgt(i As Integer)
Set xlCol = xlCol.Offset(0, i)
End Sub
==================================
I hope this helps.
Julie