PDA

View Full Version : ms project vba get data from Field



line
09-21-2015, 10:44 AM
Hi
I wanna get data from a field of an exact task and put to another field.
but the problem is the field that I wanna get data from could be every visible field in table. in fact FieldName will choose in UserForm during the VB.
code is like this: (But It does not work)

UserForm1.Show

Dim F as String

F = UserForm1.ComboBox1.Value ''''F will be a FieldName

ActiveProject.Tasks.UniqueID(1).Text1 = ActiveProject.Tasks.UniqueID(1).F


It can not find field F that is for example "Task Name" or anyfield.
how can I address the field in Project VBA like that?


Thanks

SamT
09-21-2015, 04:10 PM
I am not an MS Project man (yet) but have you tried

ActiveProject.Tasks.UniqueID(1).Text1 = ActiveProject.Tasks.UniqueID(F).text1

line
09-22-2015, 06:51 AM
I found the answer from another site

I've just wondered in 75 views no one answered me.

by the way Thanx for your care my friend :hi:

SamT
09-22-2015, 08:40 AM
Every question gets many views from our friendly lurkers... uhh, I meant learners :)

I am glad you found the answer. Would you share it with us?

line
09-22-2015, 03:24 PM
See the answer here.

stackoverflow.com/questions/32697187/ms-project-vba-get-data-from-fields

SamT
09-22-2015, 05:52 PM
Thanks