Microsoft KB Archive/219605

= FP2000: Folders.Add Method Does Not Overwrite Existing Folder =

Article ID: 219605

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft FrontPage 2000 Standard Edition

-



This article was previously published under Q219605



SYMPTOMS
When you use the Folders.Add method in FrontPage Visual Basic for Applications (VBA) and you specify a folder name that already exists in the web to add to the web, the folder will not be overwritten.

The existing folder will remain on your computer and all the content of the folder will not be modified by this line of code.



CAUSE
In FrontPage, although the Files.Add method will overwrite an existing file with the same name, the Folders.Add method will not overwrite the existing folder or delete the contents of an existing folder.



WORKAROUND
WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

If you want to remove the contents of an existing folder, and create a new folder of the same name, delete the folder and then recreate it.

For example, the following code deletes a folder named MyFolder (which also removes the content of the folder) and then creates a folder of the same name: Sub RemoveContents ActiveWeb.RootFolder.Folders.Delete ("MyFolder") ActiveWeb.RootFolder.Folders.Add ("MyFolder") End Sub

Additional query words: front page

Keywords: kbbug kbpending kbprogramming KB219605

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.