Processing Speed

R

Red

Really appreciate any help with this problem. When I step through the code
(see below example) it runs as intended but when run via a macro for
instance is terminates before completion without error. Might it be the code
is running too fast? If so how do I go about slowing it down?


For Each p In application.Projects
On Error GoTo errSave
If Not p Is Nothing Then
If p.Name <> "Definite ResPool" Then
If p.Tasks.Count > 0 Then
p.Activate
application.ActiveWindow.Caption = "Saving Contribution
data to Excel"
SelectTaskColumn Column:="Name"
OutlineHideSubTasks
p.SaveAs APRoot & "All Definite", pjXLS, , , , , , , , ,
"Contribution"
End If
End If
End If
Next p
 
J

Jack D.

Red said:
Really appreciate any help with this problem. When I step through the code
(see below example) it runs as intended but when run via a macro for
instance is terminates before completion without error. Might it be the
code is running too fast? If so how do I go about slowing it down?


For Each p In application.Projects
On Error GoTo errSave
If Not p Is Nothing Then
If p.Name <> "Definite ResPool" Then
If p.Tasks.Count > 0 Then
p.Activate
application.ActiveWindow.Caption = "Saving
Contribution data to Excel"
SelectTaskColumn Column:="Name"
OutlineHideSubTasks
p.SaveAs APRoot & "All Definite", pjXLS, , , , , , ,
, , "Contribution"
End If
End If
End If
Next p

I don't know if it is going to fast or what, however I'd like to ask what it
is doing.
Why are you selecting the column and hiding subtasks?
There should be no need to do this if all you are doing is saving the file.
Insert something like a message box showing the project name right after you
activate it so you can see what is going on.


--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP


+++++++++++++++++++
 
R

Red

This project is a read/write master of a resource pool.I only want to export
the schedule summary bars of each merged project to Excel and this was the
only way I could get it to work.
 
J

Jack D.

You should not have to select the TaskColumn in any case.
You can avoid the p.activate as well.
You can also avoid the saveas if you want to.

Go to my website
http://masamiki.com/project/macros.htm
Open the "Export Heirarchy to Excel" Macro.
Copy out the relevant bits for opening an excel file
Then take the first part of your macro (through the if p.Tasks.Count > 0)
and stuff it in there.
Then using p.tasks(0) as the task to export edit the rest of my macro to
copy over the information you want.
Following that move to the next line in excel and use "next p" to go through
the rest of the projects.

The result will be the summary task information all in one single excel
file.
It should be much faster and cleaner than the process you have already.
Post any followup questions to the Microsoft.public.project.vba newsgroup.

-Jack
This project is a read/write master of a resource pool.I only want to
export the schedule summary bars of each merged project to Excel and this
was the only way I could get it to work.



--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP


+++++++++++++++++++
 

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