J
Jeff
I am trying to substitute a palceholde "holder" with variables "pjTask",
pjResources, "pjResourceEnterprise" everytime the loop iterates through the
loop.
when I use the Locals window my variables seem to be right even tjhough I
get an error during the first loop at the "If
ts(it).GetField(FieldNameToFieldConstant(myType & i, holder)) <> "" Then"
line of code.
================================================
Sub Test()
Dim mycheck As Boolean
Dim myType, usedfields As String
Dim T As task
Dim ts As Tasks
Dim i, it As Integer
Dim holder As String
Dim Testing As Integer
Set ts = ActiveProject.Tasks
usedfields = "Custom Fields used in this file" & vbCrLf
For Testing = 1 To 3
If Testing = 1 Then holder = pjTask
If Testing = 2 Then holder = pjResource
If Testing = 3 Then holder = pjResourceEnterprise
myType = "Text"
usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" &
vbCrLf
For i = 1 To 30
mycheck = False
it = 0
While Not mycheck And (it < ts.Count)
it = it + 1
If Not ts(it) Is Nothing Then
If ts(it).GetField(FieldNameToFieldConstant(myType & i,
holder)) <> "" Then
usedfields = usedfields & myType & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i
myType = "Number"
usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" &
vbCrLf
For i = 1 To 20
mycheck = False
it = 0
While Not mycheck And (it < ts.Count)
it = it + 1
If Not ts(it) Is Nothing Then
If ts(it).GetField(FieldNameToFieldConstant(myType & i,
holder)) <> 0 Then
usedfields = usedfields & myType & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i
Next Testing
MsgBox usedfields
End Sub
pjResources, "pjResourceEnterprise" everytime the loop iterates through the
loop.
when I use the Locals window my variables seem to be right even tjhough I
get an error during the first loop at the "If
ts(it).GetField(FieldNameToFieldConstant(myType & i, holder)) <> "" Then"
line of code.
================================================
Sub Test()
Dim mycheck As Boolean
Dim myType, usedfields As String
Dim T As task
Dim ts As Tasks
Dim i, it As Integer
Dim holder As String
Dim Testing As Integer
Set ts = ActiveProject.Tasks
usedfields = "Custom Fields used in this file" & vbCrLf
For Testing = 1 To 3
If Testing = 1 Then holder = pjTask
If Testing = 2 Then holder = pjResource
If Testing = 3 Then holder = pjResourceEnterprise
myType = "Text"
usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" &
vbCrLf
For i = 1 To 30
mycheck = False
it = 0
While Not mycheck And (it < ts.Count)
it = it + 1
If Not ts(it) Is Nothing Then
If ts(it).GetField(FieldNameToFieldConstant(myType & i,
holder)) <> "" Then
usedfields = usedfields & myType & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i
myType = "Number"
usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" &
vbCrLf
For i = 1 To 20
mycheck = False
it = 0
While Not mycheck And (it < ts.Count)
it = it + 1
If Not ts(it) Is Nothing Then
If ts(it).GetField(FieldNameToFieldConstant(myType & i,
holder)) <> 0 Then
usedfields = usedfields & myType & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i
Next Testing
MsgBox usedfields
End Sub