trouble importing actual start data, every other time

T

theintern

I have a macro which imports data from Access to Project, including Actual
Start. However, for one of the tasks it doesn't import Actual Start every
other time. First time: doesn't work, second time: does, third time:
doesn't, etc...Not sure how it selects which task for it to fail on either.

see below for code. the import happens at the very beginning. the rest of
it is just maniputaing different views and producing lots of pictures.

any ideas, suggestions would be great!

thanks
scott

Sub ImportAll()
' Imports All
Dim ts As Tasks
Dim t As Task

DisplayAlerts = False
'Imports Data
FileOpen Name:="<C:\Documents and
Settings\deckers\Desktop\Database.mdb>", ReadOnly:=False, Merge:=1,
FormatID:="MSProject.MDB8", map:="SMmap"
FileOpen Name:="<C:\Documents and
Settings\deckers\Desktop\Database.mdb>", ReadOnly:=False, Merge:=1,
FormatID:="MSProject.MDB8", map:="PLBmap"
FileOpen Name:="<C:\Documents and
Settings\deckers\Desktop\Database.mdb>", ReadOnly:=False, Merge:=1,
FormatID:="MSProject.MDB8", map:="PIPmap"
FilterApply Name:="All Active"

'Eliminates all task constraints
SelectAll
SetTaskField Field:="Constraint Type", Value:="As Soon As Possible",
AllSelectedTasks:=True

'Levels Desired Resources
ViewApply Name:="Resource &Sheet"
SelectRow Row:=0
'ATTN: MANAGER edit here to add/delete resource. Resource added:
Height+1.
'Resource deleted: Height-1.
SelectRow Row:=0, Height:=5, Extend:=True
LevelNow All:=False
ViewApply Name:="&Gantt Chart"

'Backfeeds unassigned tasks
FilterApply Name:="Yes"
SelectAll
If Not ActiveSelection = 0 Then
SetTaskField Field:="Constraint Type", Value:="As Late As Possible",
AllSelectedTasks:=True
SetTaskField Field:="Actual Start", Value:="", AllSelectedTasks:=True
End If
FilterApply Name:="All Active"

'Sets proper scale, Weeks and Days
ZoomTimescale Entire:=True
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MajorCount:=1, MinorCount:=1, MinorTicks:=True,
Separator:=True, MajorUseFY:=True, MinorUseFY:=True, TierCount:=2
SelectAll

'Creates first 3 pictures
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="C:\Documents and Settings\deckers\Desktop\pics\TwoWeeks.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="C:\Documents and Settings\deckers\Desktop\pics\OneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="C:\Documents and
Settings\deckers\Desktop\pics\Today.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2

'Creates SM pic
FilterApply Name:="SM"
'Changes the font/bar size
'GanttBarSize Size:=pjBarSize18
'TextStyles Item:=0, Size:="10"
SelectAll
If Not ActiveSelection = 0 Then
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="C:\Documents and Settings\deckers\Desktop\pics\SM.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates PLB pic
FilterApply Name:="PLB"
SelectAll
If Not ActiveSelection = 0 Then
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="C:\Documents and Settings\deckers\Desktop\pics\PLB.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates PIP pic
FilterApply Name:="PIP"
SelectAll
If Not ActiveSelection = 0 Then
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="C:\Documents and Settings\deckers\Desktop\pics\PIP.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'ATTN: MANAGER edit here to add a snapshot of the new resources workload.
'Copy, paste this section. Then edit code appropriately and uncomment
'(see below for examples)
'Note: don't forget to change the file name in the 2nd to last line of
code here
'Creates "New resources initial here" pic
'FilterApply Name:="Resource Initials Here"
'SelectAll
'If Not ActiveSelection = 0 Then
' EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\DFTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
' EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\DFOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
' 'Dislplays hours on the timeline as well
' TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
' EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\DFToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
'End If

'Creates DF pics
FilterApply Name:="DF"
SelectAll
If Not ActiveSelection = 0 Then
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\DFTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\DFOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\DFToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates GL pics
FilterApply Name:="GL"
SelectAll
If Not ActiveSelection = 0 Then
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\GLTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\GLOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\GLToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates JM pics
FilterApply Name:="JM"
SelectAll
If Not ActiveSelection = 0 Then
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\JMTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\JMOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\JMToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates JW pics
FilterApply Name:="JW"
SelectAll
If Not ActiveSelection = 0 Then
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\JWTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\JWOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\JWToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates LG pics
FilterApply Name:="LG"
SelectAll
If Not ActiveSelection = 0 Then
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\LGTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\LGOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\LGToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Creates MV pics
FilterApply Name:="MV"
SelectAll
If Not ActiveSelection = 0 Then
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (15 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\MVTwoWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=0,
FromDate:=Date - Weekday(Date) + 1, ToDate:=Date + (8 - Weekday(Date)),
FileName:="U:\Estimating Log\Est Schedule\MVOneWeek.gif",
ScaleOption:=pjCopyPictureShowOptions, MaxImageHeight:=-1#,
MaxImageWidth:=-1#, MeasurementUnits:=2
'Dislplays hours on the timeline as well
TimescaleEdit MajorUnits:=4, MinorUnits:=5, MajorLabel:=23,
MinorLabel:=32, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2
EditCopyPicture Object:=False, ForPrinter:=2, SelectedRows:=1,
FromDate:=Date + 0.25, ToDate:=Date + 0.79167, FileName:="U:\Estimating
Log\Est Schedule\MVToday.gif", ScaleOption:=pjCopyPictureShowOptions,
MaxImageHeight:=-1#, MaxImageWidth:=-1#, MeasurementUnits:=2
End If

'Changes size back to normal
'GanttBarSize Size:=pjBarSize14
'TextStyles Item:=0, Size:="8"
'Reverts to normal weeks and days
TimescaleEdit MajorUnits:=3, MinorUnits:=4, MajorLabel:=13,
MinorLabel:=20, MinorTicks:=True, Separator:=True, MajorUseFY:=True,
MinorUseFY:=True, TierCount:=2

FilterApply Name:="All Active"

'SelectAll
'EditDelete
DisplayAlerts = True
FileSave

'ATTN: MANAGER Edit here to keep the project open for editing
'FileClose

End Sub
 
T

theintern

I think it may have something to do with the leveling of resources. If it
imports correctly, but i level resources again, then a few of the Actual
Start boxes get wiped out. I hope this helps.

thanks
scott
 
T

theintern

Yeah, i thought that might be the problem too, but i don't think so. it was
erasing the Actual Start on tasks given resources other than "Yes" which
don't show up in that filter, so i don't see how they could've been selected.
i got around it by redoing some things in the other pieces of code (i had
other macros to change calendars) and that actually seemed to fix it. not
exactly sure what was going on, but it appears to be working now. it's not
as efficient, with the repetition, but it's by no means slow and it works,
so...

thanks!

scott
 
T

theintern

So i found out the line of code causing the problem. if i have either of the
following lines, then it starts randomly deleting Actual Start data.

LevelingOptions AutoClearLeveling:=True
or
LevelingClear All:=True

Any idea why these lines would delete Actual Start data every other time?
It seems so random...and yes, as soon as changed to False it works fine

thanks
scott
 
J

Jan De Messemaeker

Hi,

Again, I'm not sure you are using Actual Start the way it is intended to be
used, and I'm under the impression that you have tasks with a date in Actual
start but Actual Work and Actual Duration zero.
I don't know how clear leveling may react to such an anomaly.
Hope this helps,

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
T

theintern

True, actual duration and actual work are both zero. How do these affect
actual start? i guess i am confused...

thanks jan,
scott
 

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