Solved

VBA to make a ReadOnly file ReadWrite

Posted on 2010-09-23
1
718 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

810 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