The information in this article applies to:
SYMPTOMSWhen you run a Microsoft Visual Basic for Applications procedure to save a file using the Save method, if the file is opened as read-only, the file may be saved to the current directory or folder, instead of an error message appearing indicating that the file cannot be saved. CAUSE
This behavior occurs when the file that you are saving is open, has a read-
only protection status, and the current directory or folder is not the
directory or folder that contains the file. In this case, the file is saved
to the current directory or folder without displaying an error message
explaining that the file is read-only.
When you use the Save method to save a file that is open as read-only, and
the current directory or folder IS the directory or folder that contains
the open file, then you receive a dialog box with the following message
where <filename> is the name of the file you are saving. You then receive the following error message:
RESOLUTIONMicrosoft 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/overview/overview.aspTo avoid this behavior, use any of the following methods. Method 1: Use the SaveAs MethodUse the SaveAs method to save the file to another folder or directory as in the following examples:Macintosh: ActiveWorkbook.SaveAs FileName:="Macintosh HD:Excel:Book1.xls"Windows: ActiveWorkbook.SaveAs FileName:="C:\Excel\Book1.xls" Method 2: Close and Reopen the FileClose the file and open it again with read-write access in order to save the file to the same directory.Additional query words: 8.0
Keywords : kbcode kbprg PgmOthr |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |