Transferring fields

M

MarkC

This should be a simple question to answer. I just want clarification that my
macro is correct and this is the nest solution for me.

I developed a new system using many customised fields. However, many of my
users use the same data but in different customised fields. So what I want to
do is restructure/map their fields to mine. Would the following code work?

Sub FieldMapping()

Dim mytask As Task

For Each mytask In ActiveProject.Tasks
If Not (mytask Is Nothing) Then
mytask.Text1 = mytask.Text5
mytask.Text2 = mytask.Text3
mytask.Text3 = mytask.Text4
mytask.Text4 = mytask.Text12
mytask.Text5 = mytask.Text6
mytask.Finish1 = mytask.Date1
mytask.Number1 = mytask.Number4
End If
Next mytask

End Sub

If I want the value that's in Text1 to go Text6 but in the above example I
have Text5 going into Text1, then I will need to save Text1 data into a
temporary Text field at the start and later put it into Text6. I am fine with
this logic.

However, will I have problems if they use a number field and I use a text
field or viceversa?
Cheers,

Mark
 
J

Jan De Messemaeker

Hi,

1. Yes this code will work
2. Number to text will work, text to number only if numeric of course
You could test something like this
If Isnumeric (mytask.text11) then
Mytask.number7=cdbl(mytask.text11)
end if

Using cdbl and cstr can't be bad.
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
M

MarkC

Cool - Many Thanks Jan

Jan De Messemaeker said:
Hi,

1. Yes this code will work
2. Number to text will work, text to number only if numeric of course
You could test something like this
If Isnumeric (mytask.text11) then
Mytask.number7=cdbl(mytask.text11)
end if

Using cdbl and cstr can't be bad.
HTH

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 

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