How do I Export a Report such as a Cash Flow to Excel?

M

Magikwolf

I've searched for this answer for about 2 months already, and I have not got
any solutions. The farthest I got to unraveling this was printing the cash
flow to a PDF file, and then copy/Paste the results to excel. But as you
could imagine, this is not a fine solution when you have to build a cash flow
with thousands of activities and lots of pages.
 
J

JackD

It is fairly simple to write a macro to do this.

This one exports budget and actual cost to a txt file you can open in excel.
It can be modified to export other stuff as well.

-------snip-------------
Sub Cashflow()
Dim mystring, MyFile As String
Dim jStart, jStatus, jEnd As Date
Dim fnum As Variant
Dim jPeriod As Integer
Dim myBCWS, myACWP As Currency
Dim myTask As Task

MyFile = "c:\" & "Cashflow_" & ActiveProject.Name & "_" & Date$ & ".txt"

fnum = FreeFile()
Open MyFile For Output As fnum
mystring = ActiveProject.Name & " " & ActiveProject.LastSaveDate & " " &
Application.UserName
Write #fnum, mystring 'write project info
Write #fnum, ' Write blank line.
jPeriod = 7 'select time reporting period 1 = 1 day, 7 = 1 week
jStart = ActiveProject.ProjectSummaryTask.start
jEnd = ActiveProject.ProjectSummaryTask.Finish
jStatus = jStart
myBCWS = 0
myACWP = 0

Do While jStatus <= jEnd + jPeriod
ActiveProject.StatusDate = jStatus
'CalculateProject
myBCWS = 0
myACWP = 0
For Each myTask In ActiveProject.Tasks
If Not myTask Is Nothing Then
'use flag 20 to control items you don't want to export
If Not myTask.summary And myTask.Flag20 Then
myBCWS = myBCWS + myTask.BCWS
myACWP = myACWP + myTask.ACWP
End If
End If
Next myTask
mystring = jStatus & ", " & myBCWS & ", " & myACWP
Write #fnum, mystring 'write project info

jStatus = jStatus + jPeriod
Loop
MsgBox "export complete"
Close #fnum
End Sub
----snip-------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top