Consulting

Results 1 to 2 of 2

Thread: Overwrite write reserved file with updated copy (same name; also write reserved)

  1. #1
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    240
    Location

    Overwrite write reserved file with updated copy (same name; also write reserved)

    Is it possible to use VBA to overwrite a file previously saved as read only with an updated copy (same name), also as read only? "Run-time error '1004': Operation failed. "\\mgadmdat\public\Reliability & Engineering Services\Workshop and Fabrication Service\Fabrication\ISO 9001\Contractors Score Card\Archive\Fabrication Contractor Score Card (2011 - 2012).xls' is write reserved." I.e. "Operation failed. 'FullFileName.xls' is write reserved." I get this error when I am trying to overwrite the existing file with the following code: (Note: The code must also work when there are no previously saved copy)
     Dim NewBookName As String  NewBookName = Range("FabConSCFFN").Value  ActiveWorkbook.SaveAs FileName:=NewBookName, _         FileFormat:=xlNormal, _         PassWord:="", _         WriteResPassword:=WagWoord, _         ReadOnlyRecommended:=True, _         CreateBackup:=False
    I appreciate your time, Regards, vanhunk Also posted at the following due to user interface problems: http://www.excelforum.com/excel-prog...ml#post3574499
    Last edited by vanhunk; 02-06-2014 at 04:00 AM.

  2. #2
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    240
    Location
    Solved by BrianMH:

    Sub OpenReadOnlyFileWithPassword()
    
    Workbooks.Open Filename:="ReadOnlyFile.xls", WriteResPassword:="Wagwoord", _
                   ReadOnly:=False, IgnoreReadOnlyRecommended:=True
    
    End Sub
    Thank you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •