MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Help with dynamic labels in Project VBA

  Asked By: Fern    Date: Mar 09    Category: MS Office    Views: 4470

I'm trying to create a form dynamically in Project 2007 using VBA
I need to add a label with the task name:

This should be correct, but I dont' see the new label:

Set label = Me.Controls.Add("Forms.Label.1", "lbl" & t, True)
label.Height = h
label.Left = l
label.Top = t
label.Width = w
label.Enabled = True
label.ForeColor = red

label.Caption = task.Name

What could i be doing wrong? There are no errors/exceptions here.



1 Answer Found

Answer #1    Answered By: Mandy Harvey     Answered On: Mar 09

It is never a good idea to use a keyword as the name of an object so I would
call the label "myLabel" or better "lblTaskName"

I do not have Project, but it seems to me the "True" is supposed to be a
position indicator.

Do you need to set the label visible?

Is the position somewhere within the visible window? (Check the units you are

Didn't find what you were looking for? Find more on Help with dynamic labels in Project VBA Or get search suggestion and latest updates.