manipulating fields by field names

A

adam

Hi everybody,

I am trying to import task data to Project from Lotus Notes using Lotus
Notes script (which is very similar to VB).

I create an instance of the project Application and can manipulate
application properties but not the fields.

What i tried was recording macro and the recorder output was stg like :
SetTaskField Field:="Name", Value:="Task1"

I can't use it alone like this way, is there a different method to obtain
field names and assign values to current row according to fields? (probably
by VB not SQL).

Any help would be appreciated.

Thanks.
 
M

Matt Rondeau

Adam,

Here's some code for you to look at. Check out what I've posted below--you
may find it helpful.

'SetTaskField
'--------------------------------------------------
'This will only work on the currently selected row.
'You need to set the focus to the next row down
'using SelectCellDown
'--------------------------------------------------
SetTaskField Field:="Name", Value:="Task " & ActiveProject.Tasks.Count + 1
Dim newRow As Integer
newRow = (ActiveProject.Tasks.Count - ActiveProject.Tasks.Count) + 1
SelectCellDown NumCells:=newRow

'Add tasks using Tasks Collection
'--------------------------------------------------
'This method doesn't require you to move the active
'selection like the method above does.
'--------------------------------------------------
ActiveProject.Tasks.Add Name:="Task " & ActiveProject.Tasks.Count + 1

'To set fields, you'll want to obtain the a reference to the task
'you just created.
Dim tsk As MSProject.Task
Set tsk = ActiveProject.Tasks.Add(Name:="Task " &
ActiveProject.Tasks.Count + 1)

'Set fields using task as qualifier (or other method using string name
or field
'constant using FieldNameToFieldConstant() or FieldConstantToFieldName
'[respectively]).
tsk.Text10 = "Lotus task data text10"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top