How to lock external workbooks

markadon

Board Regular
Joined
Feb 12, 2007
Messages
193
I have 30+ supervisors who each have their own workbook containing data in a (for our company) standard format. I have a master workbook that reads the data from each supervisor workbook, massages it, and re-writes it to the individual workbooks. The massaging may take several minutes. I want to lock all the workbooks BEFORE I read in the data and then unlock it AFTER I write the data. Is there some way, other than leaving them open (they all have the same name), to use VBA to lock the workbooks until I'm done with them?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
You can copy each workbook from its current folder to a different "secret" folder (named for the supervisor since the files all have the same name) and delete the original. Massage and close the files, then copy them back to their source folders and archive the ones you massaged until you get next day's copy. You will not have to keep each workbook open, but the supervisor will not be able to find it, so it is effectively "locked".

to copy a file
Code:
Name strOldFileFullPathName As strNewFileFullPathName
to delete a file
Code:
Kill strOldFileFullpathName
 
Upvote 0
Thanks. I thought about that last night and it was the only way I could come up with, too.
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

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