Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File management (Word/VBA 97/2000)

    How can I save on top of a Word document that has Read-Only as a file attribute? I can read it, I can save it elsewhere in a read-write mode, but I can not overwrite the darned thing. Keep in mind this is a file attribute, not a Word property. I want to be able to overwrite a read-only file with another copy that is itself read-only.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File management (Word/VBA 97/2000)

    And you feel confident that whoever set the read only attribute will not mind your overwriting the file? I mean why set that attrib if you can overwrite the file?

    Oh well, you must have a good reason...

    SetAttr ActiveDocument.FullName, vbNormal
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #3
    Star Lounger
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File management (Word/VBA 97/2000)

    thanks! I do have a good reason -- I'm creating a minimal document management system for someone. I control the vertical, I control the horizontal -- and I write the procedures. So I am OK with doing it, if I can. Thanks again.

    Dale

  5. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: File management (Word/VBA 97/2000)

    Maybe (pseudocode):

    If Exists(MyPath) Then
    If MsgBox("Overwrite existing file?", vbYesNo) = vbYes Then
    MyPath.ReadOnly = False
    MyPath.Delete
    Document.SaveAs NewPath, ReadOnly
    End If
    End If

    The FileSystemObject probably is the best way to handle this.

Posting Permissions

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