Solved

VBA to make a ReadOnly file ReadWrite

Posted on 2010-09-23
1
720 Views
Last Modified: 2012-05-10
I'm using this code to make copy of a ReadOnly template file.

    fs.Copyfile m_sFolderPathOutputs

When I try to save the file a Save dialog box prompts me to specify the new name and location where I want to save a copy of the file (presumably because the file is ReadOnly).

I'm looking for any way to avoid having this dialog pop up: either a parameter in the Save method that says overwrite the ReadOnly file, or setting DisplayAlerts = False, or VBA to make the file ReadWrite before the save, etc.
0
Comment
Question by:ltdanp22
1 Comment
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 500 total points
ID: 33744966
You can use SetAttr just before you save and then set it back to readOnly after the save/overwrite.
SetAttr "g:\file.txt", vbNormal
SetAttr "g:\file.txt", vbNormal Or vbReadOnly

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reading the Contents of a Directory In Access VBA 5 77
passing parameter in sql procedure 9 65
message box in access 4 51
MS Date Picker 64 bit 32 bit issue 12 61
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question