Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA to make a ReadOnly file ReadWrite

Posted on 2010-09-23
1
Medium Priority
?
733 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 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