Guild of Project Controls: Compendium | Roles | Assessment | Certifications | Membership

Tips on using this forum..

(1) Explain your problem, don't simply post "This isn't working". What were you doing when you faced the problem? What have you tried to resolve - did you look for a solution using "Search" ? Has it happened just once or several times?

(2) It's also good to get feedback when a solution is found, return to the original post to explain how it was resolved so that more people can also use the results.

VBA code for setting Income value

1 reply [Last post]
Dariusz C
User offline. Last seen 2 years 40 weeks ago. Offline
Joined: 10 Dec 2018
Posts: 8
Groups: None

Hi experts

I'm writing macro for Asta and hit the wall when I want to assign income value in task.

Below code finds Income Cost Centre assigned, but can't find a way to set value.

Dim t As TaskBase

Dim bcv As BarChartView
Dim ca As CostAllocation

 Set bcv = ap.CurrentView
 AllTasks = bcv.AllTaskBaseIds
  For Each act In AllTasks    
     For i = 1 To t.Allocations.Count
             Set ca = t.Allocations(i)
         'here I need to set income value on this task 
      Next i
 Next act


Thank you in advance for any hints!

Replies

Dariusz C
User offline. Last seen 2 years 40 weeks ago. Offline
Joined: 10 Dec 2018
Posts: 8
Groups: None

It wasn't work with ca.Value.
I found that work like below:

The missing code is:

ca.GivenValue = 100 ' or whatever you need

Topic closed :)