View Single Post
 
Old 07-15-2019, 12:12 AM
Zeichner Zeichner is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2019
Posts: 1
Zeichner is on a distinguished road
Question VBA Project Bar Format

Hi everyone

I would like to access the collection processes in MS Project with VBA to format them.
Is this possible without the column "collection process" visible?
I only worked with:

SelectRange row: = i + 1, Column: = 2, RowRelative: = False

I refer to the column where the column is currently containing the information I need, but how can I access the control if I do not want the column visible?
My complete code is to color the bars based on specific values (task names).
Now I would like to additionally find all collections and change the bar type, but I do not want to see the "Summary" column in the program.
How can I access these values?

Code:
Sub BalkenFärben()

    Dim Inhalt, InhaltNeu, Trennzeichen, Trennzeichen2 As String
    Dim i, Werte As Integer
    Dim ArrDaten(0 To 10, 0 To 10) As Double
    Dim Sammelvorgang As Boolean
    
    
    Trennzeichen = "_"


    'Von - Bis Spalten
    For i = 0 To 40
    
        'definiere Zeile mit schleife
        SelectRange row:=i + 1, Column:=2, RowRelative:=False
        Inhalt = ActiveCell
        
        'If IsEmpty(ActiveCell.row) = True Then End
        'letzte zeile finden????
        
        'Wenn Zelle leer dann nächster schritt in Schleife
        If Inhalt = "" Then
        
        'Wenn Zelle nicht leer dann:
        Else
            Inhalt = Split(Inhalt, Trennzeichen)(0)
              
                ArrDaten(0, 0) = 111#: ArrDaten(0, 1) = 5855577
                ArrDaten(1, 0) = 112#: ArrDaten(1, 1) = 5855577
                ArrDaten(2, 0) = 113#: ArrDaten(2, 1) = 5855577
                ArrDaten(3, 0) = 114#: ArrDaten(3, 1) = 5855577
                ArrDaten(4, 0) = 114.1: ArrDaten(4, 1) = 5855577
                ArrDaten(5, 0) = 115#: ArrDaten(5, 1) = 5855577
                ArrDaten(6, 0) = 116#: ArrDaten(6, 1) = 5855577
                ArrDaten(7, 0) = 171#: ArrDaten(7, 1) = 9279917
                ArrDaten(8, 0) = 172#: ArrDaten(8, 1) = 8498133
                ArrDaten(9, 0) = 173#: ArrDaten(9, 1) = 8498133
                ArrDaten(10, 0) = 174#: ArrDaten(10, 1) = 8498133
                
    
                For Werte = 0 To 10
                    If ArrDaten(Werte, 0) = Inhalt Then
                    
                    
                        GanttBarFormatEx MiddleShape:=1, MiddlePattern:=1, MiddleColor:=ArrDaten(Werte, 1), StartColor:=ArrDaten(Werte, 1), EndColor:=ArrDaten(Werte, 1)
                        GanttBarFormat lefttext:="Anfang"
                        GanttBarFormat righttext:="Name"
                     
                    End If
                Next Werte
            End If
            
    Next i
    
End Sub
Reply With Quote