PRJ4: ConsolidateProjects Method: 255 Character Limit For File Names (149491)



The information in this article applies to:

  • Microsoft Project for Windows 4.0
  • Microsoft Project for Windows 95 4.1
  • Microsoft Project for the Macintosh 4.0

This article was previously published under Q149491

SYMPTOMS

In Microsoft Project, when you use the Visual Basic for Application method, ConsolidateProjects, you may receive an error message similar to the following:
Project Basic
Run-Time Error '1101'
Argument value not valid

CAUSE

This problem occurs in Microsoft Project because the Visual Basic for Application method ConsolidateProjects has a limitation of 255 characters for the Filenames argument. If you try to use a string exceeding 255 characters to represent the list of files to be consolidated, you may receive the error message mentioned above.

WORKAROUND

To work around this limitation, you can use the following methods for reducing the number of characters in the Filenames argument. The appropriate method will vary, based on the version of Microsoft Project you are using, and whether all project files are located in the same folder.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.

Method 1: Setting the Default Directory Prior to Consolidation

If you are using Microsoft Project version 4.1 for Windows 95, you can use this method to work around this problem.

If all the files to be consolidated are in the same folder, you can use the ChDir method to set the default folder. If you use this method, you avoid using the complete path to the files.

NOTE: This method will not work with Microsoft Project version 4.0.

The following procedure is an example of how you can use ChDir to avoid repeating long paths:
   Sub Consolidate_Projs()
      'Change the default folder.
      ChDir "C:\mydata\Pjfiles\myproj1"
      'Consolidate 5 project files in the default folder.
      ConsolidateProjects _
         Filenames:="P1.MPP,P2.MPP,P3.MPP,P4.MPP,P5.MPP"
   End Sub
				

Method 2: Using the Wildcard Characters "*" and "?"

If you're using Microsoft Project version 4.0, you can use this method as a workaround.

You can use wildcard characters to shorten the text string of the Filenames argument. A wildcard is a character you can use to represent other characters when you search fields for text. Wildcards include the asterisk (*), which represents any set of characters in a particular position, and the question mark (?), which represents any single character in a particular position.

NOTE: This method will not work with Microsoft Project version 4.1 for Windows 95.

The following sample macro uses a Wildcard character to consolidate all Microsoft Project files into the C:\mydata\Pjfiles folder.

   Sub Consolidate_Projs()
      'Consolidate all files with an MPP extension that are in the
      'C:\mydata\Pjfiles folder.
      ConsolidateProjects Filenames:="C:\mydata\Pjfiles\*.mpp"
   End Sub
				

Method 3: Performing Multiple ConsolidateProjects Until all Files Are Consolidated

As another possible workaround, you can consolidate files up to the 255 character limit and save the resulting consolidated project file. If there are still more files to consolidate, perform another consolidation including the previously consolidated project AND any remaining files up to the 255 character limit. Repeat this process of consolidation and consolidating consolidated projects until all files have been consolidated or until you reach the 80 file file limit. This will work for versions 4.0 and 4.1 of Microsoft Project.

Method 4: Using Shorter File Names and Shorter Directory Names

Finally, it is possible to use a shorter path to store the files or to use shorter file names. On Microsoft Project for Windows version 4.0, one way you can make your file names shorter is to omit the extension. For example, instead of specifying "Project1.mpp, Project2.mpp" and so forth, you could specify these files as "Project1,Project2". Making your path and file names shorter works for versions 4.0 and 4.1 of Microsoft Project.

MORE INFORMATION

With Microsoft Project, you can consolidate individual project files into a single window. This helps you to view information for several files as though they were a single project. For example, you can consolidate projects when you need to manage resources who work on multiple projects.

You can create and save a consolidated project file as a new project file with links to the source projects. If a consolidated project is linked to its source projects, changes to the information in the consolidated project file are reflected in the corresponding source files. Likewise, if you change information in a source file, the corresponding information is updated in the consolidated file.

NOTE: If you change the format of the consolidated project, the change does not affect the source projects.

If you do not want changes to the consolidated project file to affect the source files, you can create and save a consolidated project file without attaching to source files. ConsolidateProjects has an attachToSources argument that you can set to "No" to facilitate this operation.

The ConsolidateProjects method is the Visual Basic for Applications equivalent to pointing to Multiple Projects on the Tools menu, and then clicking Consolidate Projects.

REFERENCES

"Microsoft Project User's Guide," version 4.0, Chapter 11

"Microsoft Project User's Guide," version 4.1, Chapter 10

For additional information on using the ChDir method, please see the following article in the Microsoft Knowledge Base:

130327 PRJ4: ChDir Command Doesn't Change the Default Directory

For additional information on using string size limitations in Visual Basic for Applications in Microsoft Project, please see the following article in the Microsoft Knowledge Base:

113000 Only First 255 Characters in String Argument Recorded in Macro


Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbbug kbcode kberrmsg kbnofix KB149491