Dilemma w/Updating Read-Only Workbooks

mhague

New Member
Joined
Mar 20, 2002
Messages
14
Hello - Hopefully someone can offer a suggestion to this problem I have.

I currently have VBA code that opens a master workbook and then updates 20 departmental workbooks with data from the master. The departmental workbooks are read-only as I don't want my users to change them.
I remove the read-only attribute in my program so I can save the workbook once I've got it open in my program. Problem is, if one of the users is viewing the workbook, my program cannot access it to update it.

Is there a way to way I can keep the departmental workbooks read-only so the users can't change them, but my VBA program can open save them - even if they are being viewed at the time the program runs? I read about shared workbooks, but I don't think this is what I want. I admit I don't know that much about the intricacies of Excel...

Thanks,

Marcie
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Welcome Marcie! SetAttr Function makes it possible. :)

<PRE><FONT color=red>Sub </FONT>SetAttrtest()

<FONT color=#339966> 'Change here to your file path
</FONT>
<FONT color=red>Const </FONT>strWbPath <FONT color=red>As</FONT><FONT color=red> String</FONT> = "c:book1.xls"

<FONT color=#339966> 'When you open via vba Make read only file to Normal file.
</FONT>
SetAttr strWbPath, vbNormal

<FONT color=#339966> 'Yourcode
</FONT>
<FONT color=#339966> 'Book open and Something you want
</FONT>
<FONT color=#339966> 'Save workbook
</FONT>


<FONT color=#339966> 'After close book, Make Normal file to read only file.
</FONT>
SetAttr strWbPath, vbReadOnly

<FONT color=red>End Sub</FONT>
</PRE>
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top