Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-15-2017, 10:10 PM
Hans1958 Hans1958 is offline Check all Custom Task Fields AND HOW THEY ARE RENAMED Windows 7 32bit Check all Custom Task Fields AND HOW THEY ARE RENAMED Office 2010 32bit
Novice
Check all Custom Task Fields AND HOW THEY ARE RENAMED
 
Join Date: Jan 2017
Posts: 4
Hans1958 is on a distinguished road
Default Check all Custom Task Fields AND HOW THEY ARE RENAMED

Hi there,
I am using MS-Project 2010 and I would like to show by a MsgBox all the Custom-Task-Fields, BUT ALSO how they are RENAMED.
For that matter I found in the internet this VBA code. I works fine but it doesn't show how the Custom Task Fields got renamed from me. Can anybody help? Would appreciate it! Thank you dearly already in advance!
Best regards
Hans ... from Germany
----------------------------------


' MSP Checks all Custom Task Fields
Sub checkfields()
'This macro will check and report out which custom task fields are used
'It requires Project 2002 and above as it relies on the GetField
'and FieldNameToFieldConstant methods which were not introduced until
'2002.
'It does not include resource fields, however it is a simple matter to
'do it by replacing the pjTask constant with pjResource.


'Copyright Jack Dahlgren, Oct. 2004

Dim mycheck As Boolean
Dim mytype, usedfields As String
Dim t As Task
Dim ts As Tasks
Dim i, it As Integer

Set ts = ActiveProject.Tasks
usedfields = "Custom Fields used in this file" & vbCrLf

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, pjTask)) <> "" Then
nConst = ts(it).GetField(FieldNameToFieldConstant(mytype & i, pjTask)) ' -- will display the content of Text1
rNamedFld = CustomFieldGetName(FieldNameToFieldConstant(mytype & CStr(i))) ' -- will display the renamed customed field
' "Hans1958" remark: I think this is the important part. But later on my renamed customed fields are not displayed at the MsgBox; - but why?! Yikes!
usedfields = usedfields & mytype & CStr(i) & " " & rNamedFld & 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, pjTask)) <> 0 Then
usedfields = usedfields & mytype & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i

mytype = "Duration"
usedfields = usedfields & vbCrLf & "--" & UCase(mytype) & "--" & vbCrLf
For i = 1 To 10
mycheck = False
it = 0
While Not mycheck And (it < ts.Count)
it = it + 1
If Not ts(it) Is Nothing Then
If Left(ts(it).GetField(FieldNameToFieldConstant(myty pe & i, pjTask)), 2) <> "0 " Then
usedfields = usedfields & mytype & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i
mytype = "Cost"
usedfields = usedfields & vbCrLf & "--" & UCase(mytype) & "--" & vbCrLf
For i = 1 To 10
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, pjTask)) <> 0 Then
usedfields = usedfields & mytype & CStr(i) & vbCr
mycheck = True
End If
End If
Wend
Next i


MsgBox usedfields

End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check Form fields populated before save OTPM Word 12 03-10-2017 11:13 PM
Check all Custom Task Fields AND HOW THEY ARE RENAMED Save As (accidentally renamed first file) Matthew Carter Excel 1 07-22-2013 01:00 PM
Custom Task sending not working d7jab Outlook 0 10-16-2012 08:51 AM
Duplicating form fields (check-boxes) Jānis Word 3 09-16-2012 12:09 PM
Check all Custom Task Fields AND HOW THEY ARE RENAMED Custom Form Check Box's shogan Word 1 05-14-2010 09:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft