Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Read Only File to Read-Write 1

Status
Not open for further replies.

howardr

Technical User
Sep 26, 2002
14
US
Hello,

I have just started using VBA, and I have a VB program in an Access database that needs to copy information from an Access Table into an Excel Spreadsheet. I have the coding for this completed, except for the fact that once the Excel spreadsheet is saved, I would like to make it Read Only. I will want to rewrite over the information in this Excel Spreadsheet each time the Access VB program is run. Is there a way I can turn off the Read Only when the Access program runs and copies the Access Table into the Excel Spreadsheet, and then saves the Excel Spreadsheet as Read Only when it is finished?

Your help would be greatly appreciated!

RH
 
Take a look at the SetAttr VBA instruction:
SetAttr "\path\to\mysheet.xls", vbNormal
' do the access stuff
SetAttr "\path\to\mysheet.xls", vbReadOnly

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This worked like a charm PHV! Thank you so much!

RH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top