ID: Q179466
The information in this article applies to:
This article describes the following known documentation errors in the Microsoft Project 98 online Help file for Microsoft Visual Basic for Applications:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/default.asp
The sample code will cause a run-time error 13 'Type mismatch'. The corrected code is:
Sub ResourceNames()
Dim A As Assignment
For Each A In ActiveCell.Task.Assignments
MsgBox A.ResourceName
Next A
End Sub
The second code fragment in the Using the Application Object section, which demonstrates the use of the Application object, contains the following line:
pj.Application.Open "My Project.mpp"
The corrected line is:
pj.Application.FileOpen "My Project.mpp"
The example attempts to rename the Standard calendar, which is not allowed. The topic should read:
The following example changes the name of the base calendar from
Night Shift to Third Shift.
Sub RenameStandardCalendar()
BaseCalendarRename FromName:="Night Shift", ToName:="Third Shift"
End Sub
The descriptive text for the example reads:
The following example sets the constraint type to SNET and the
constraint date to the current date for tasks in the active project
without constraint types.
It should read:
The following example sets the constraint type to SNET and the
constraint date to the current date for tasks in the active project with
the default constraint of ASAP.
The descriptive text and a portion of the code instruct the user to enter a date or task ID, but the code actually assumes a date or a task name. The topic should read:
The following example prompts the user for a date or a task name, and
then scrolls to that date or task in the active pane. It assumes the
user is in a task view.
Sub PromptUserForEditGotoArguments()
Dim Entry As String ' Date or task name entered by user.
Entry = InputBox$("Enter a date or a task name to which you want" _
& " to scroll in the active pane.")
' If user enters a date, scroll to a date in the active pane.
If IsDate(Entry) Then
EditGoTo Date:=Entry
' Otherwise, scroll to a task in the active pane.
Else
EditGoTo ID:=ActiveProject.Tasks(Entry).ID
End If
End Sub
The first sentence of the topic reads:
Returns the name of the field in the active cell.
It should read:
Returns the title of the field in the active cell. If a title does not
exist, then the name of the field is returned.
The first sentence of the topic reads:
Returns a List object representing the field names for all selected
fields.
It should read:
Returns a List object representing the field names (or field titles, if
available) for all selected fields.
The example code has a closing parenthesis [)] in the wrong place. It also uses the plus sign (+) when an ampersand (&) would be more appropriate. The corrected code, in part, should read:
If InStr(Projects(1).Name, ".") Then
WSName = Left$(Projects(1).Name, Len(Projects(1).Name) - 1) & "W"
Else
WSName = Projects(1).Name & ".MPW"
End If
The description for the Next argument incorrectly states that the default value is False. The actual default value is True.
The topic incorrectly describes the function of this method. It should read:
Repeats the last search and returns True if the search value is found.
Syntax
expression.FindPrevious
expression Optional. An expression that returns an Application object.
Remarks
The FindPrevious method is functionally identical to the FindNext
method. It is retained for compatibility with previous versions of
Microsoft Project.
This topic uses an uncommon font as an example and will cause an error if the font is not installed on the user's system. It should read:
The following example formats selected text using 16-point Tahoma.
Sub FormatTahoma16()
Font Name:="Tahoma", Size:=16, Bold:=False, Italic:=False, _
Underline:=False, Color:=pjBlack
End Sub
The description for the SearchKey argument reads:
Optional String. A keyword for the Index tab to search on.
It should read:
Optional String. A letter for the Index tab to search on.
The descriptive text and code sample incorrectly illustrate the function of the HelpLaunch method. The current topic reads:
The following example displays the topic or list of topics, if the
keyword has a match. If there is no match, it displays the Contents and
Index dialog box with the Index tab on top and "task" entered as the
search word.
Sub SearchHelp()
HelpLaunch Search:=True, SearchKey:="task"
End Sub
It should read:
The following example displays the Contents and Index dialog box with
the Index tab on top, where "t" is entered as the search word and the
first index entry that starts with "t" is selected.
Sub SearchHelp()
HelpLaunch Search:=True, SearchKey:="t"
End Sub
The sample code will cause a run-time error 13 'Type mismatch' if the standard rate is not a number. The corrected code should read:
Sub SetOverTimeRate()
Dim R As Resource ' Resource object used in For Each loop
Dim StdRate As Double ' Numeric value of resource's standard rate
Dim Count As Integer ' Counter used in For Next loop
Dim FirstNumber As Integer ' Position of the first number
For Each R In ActiveProject.Resources
' Find the first character that is a number
For Count = 1 To Len(R.StandardRate)
If IsNumeric(Mid(R.StandardRate, Count, 1)) Then
FirstNumber = Count - 1
Exit For
End If
Next Count
' Strip off any leading currency symbol and then use the
' Val function to ignore any characters that follow the number
StdRate = Val(Right$(R.StandardRate, Len(R.StandardRate) - FirstNumber))
' Set the overtime rate
R.OvertimeRate = 1.5 * StdRate
Next R
End Sub
The code sample under the heading Using the Pane Object, which demonstrates the use of the Pane object, contains the following line:
ViewApplyName:="Check Tasks View"
The corrected line is:
ViewApplyName:="Check Resources View"
The code sample under the heading Using the PayRate Object, which demonstrates how to add a PayRate object to the PayRates collection, incorrectly uses parentheses around the arguments for the Add method:
ActiveProject.Resources("Tamara").CostRateTables("C"). _
PayRates.Add("12/1/96", "$25/h", "$40/h", "$0")
The corrected line is:
ActiveProject.Resources("Tamara").CostRateTables("C"). _
PayRates.Add "12/1/96", "$25/h", "$40/h", "$0"
The description for the Next argument incorrectly states that the default value is False. The actual default value is True.
The sample code contains the same syntax error on two lines. The part of the two lines that read
Left$(Project.Name, 3)
should read:
Left$(ActiveProject.Name, 3)
The description of the StartSplitOn and EndSplitOn arguments contains potentially misleading information about where the start and end time information comes from. It should read:
(StartSplitOn) "If a time is not specified, the project's default end
time for the working period is used."
(EndSplitOn) "If a time is not specified, the project's default start
time for the working period is used."
The code sample contains a variable declaration and value assignment that can cause a run-time error. The variable WhichTask (which is declared as a String) should be declared as a Long. The current line reads:
Dim WhichTask As String
It should read:
Dim WhichTask As Long
Additionally, the line which reads:
WhichTask = InputBox$("Which task would you like to split?")
should read:
WhichTask = InputBox("Enter the ID of the task you would like to " _
& "split:")
The descriptive text for the sample code states:
The following example displays the name of every task in the selection.
However, the sample code has no provision for showing the output of the
results.
You should insert the text "MsgBox Names" into the code, immediately after the line "Next T."
The descriptive text for the example code does not fully explain the situation in which the example should be run.
It would be more accurately stated as: "The following example creates a new project based on the template of the active project, if the active project was previously created from a Microsoft Project template file (.mpt)."
Also the corrected example code below will create a new Project file if the template file as described above is in the current folder.
Sub CreateNewProject()
FileOpen ActiveProject.Template & ".mpt"
End Sub
The descriptive text for the sample code does not fully explain its function. The current text reads:
The following example removes a successor from every task in the active
project.
It should read:
The following example removes the specified successor from every task in
the active project.
The sample code incorrectly attempts to apply a task filter to a view that only shows resources. The part of the line using the ViewEditSingle method that reads
Screen:=pjResourceSheet
should be changed to:
Screen:=pjGantt
The first sentence of the text explaining how to use the Weekday object reads, in part: "...three character name."
It should read: "...three letter abbreviation of the day name."
Additional query words:
Keywords : kbprg kbdta kbdtacode PROJVBA
Version : WINDOWS:98
Platform : WINDOWS
Last Reviewed: May 17, 1999