Is there a way to quickly reset the values in a custom field?

W

WD

The custom fields that I am currently using have to be
moved to new ones. This I have done. The last leg of the
process that I want to do is to clear the values left
behind in the old fields. My initial approach was to the
something like the following:

for each tsk in tsks
tsk.textn = ""
next tsk

this approach seems to take very long given the projects I
am working with averages over 1200 tasks. Is there a more
efficeint way to do this?
 
J

John

WD,
1200 tasks isn't really that many - your PC must be pretty slow if it
takes that long to run a simple loop as you have shown. However, an
alternate method that may be faster is to set up a table in a Gantt
chart view wherin all of the custom fields that you want to clear are
adjacent to each other. Then use the SelectTaskColumn Method in a code
sequence similar to the following and clear them all in one fell swoop:

SelectTaskColumn Column:=. . .
EditClear

Hope this helps.
John
 
J

Jack D.

WD said:
The custom fields that I am currently using have to be
moved to new ones. This I have done. The last leg of the
process that I want to do is to clear the values left
behind in the old fields. My initial approach was to the
something like the following:

for each tsk in tsks
tsk.textn = ""
next tsk

this approach seems to take very long given the projects I
am working with averages over 1200 tasks. Is there a more
efficeint way to do this?

In project insert a column that is known to be blank (any custom field you
have never used would work)
Select the column. Copy (Control+C or choose from the edit menu)
Select your other customized field. Paste.
That should do it.




--
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
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 
W

WD

Thanks John,

I'll keep this one. I made some changes to the original
code and it ran faster...but I will keep that technique
for future reference.
 
J

John

WD,
I forgot to mentiion in my post that I have tried both methods - looping
through all tasks with a For/Each type loop, and using the EditClear
method. Depending on the PC and the version of Project, I found that
sometimes one method runs faster than the other. Based on that, you
might just want to try the EditClear even though you did speed up your
original loop.

John
 
T

Tomm \(Intersoft Norway\)

In my VBA loops in MS Project I ALWAYS do the following:

For Each oTask in Activeproject.Tasks
If not (oTask is nothing) then
If oTask.Text10 <> "" Then
oTask.Text10 = ""
End If
End If
Next

Make sure you test whether it's necessary to edit a field and force MS
Project to recalculate internally. I believe this will speed up your code.

Tomm
 

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