|
-
Jul 13th, 2005, 02:13 PM
#3
Thread Starter
New Member
Re: MS Project VBA, the red-headed stepchild
I ended up re-wring that code a different way. It works now. The issue now is understanding MS Project. I am trying to select a cell, which I can, and then return a string for what text is in it, which I just can't figure out. Here is an exact picture of the project and what I can't identify.
I am trying to select a resource code, store it as a string, match that string to a value in Excel spreadsheet, then fill out the hours accordingly. I just can't return a value, it seems so simple but I just can't make any code work.
VB Code:
Rws = 1
ViewApply Name:="Tas&k Usage"
SelectTaskField Row:=1, Column:="Name", RowRelative:=True
For R = 2 To ActiveProject.Tasks.Count
ObjTask = ActiveProject.Tasks(R).Name
Sheets("Summary Hrs").Activate
Columns("B:B").Select
Selection.Find(What:=ObjTask, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
Rws = ActiveCell.Row + 1
If Cells(Rws, "C") <> "" Then
SelectTaskField Row:=0, Column:="Name"
'below selects the resource code's cell
SelectTaskField Row:=1, Column:="Name"
'MyResource is nothing. I've tried different
'ways of using ActiveProject or ActiveSelection
'with no avail
MyResource = ActiveSelection.FieldName
'this is where I go to excel, match the value
'grab the "hours" value, then stick it where it goes
SetResourceField Field:="Work", Value:=hours, AllSelectedResources:=True
End If
Next R
So any suggestions????
QueenB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|