File Already Open...

Shedbandit

New Member
Joined
Jul 3, 2004
Messages
6
Im currently developing a system at work that has users writing to an excel file on a shared drive. Users fill in a VB form that submits the values into a seperate excel workbook. This works fine up until 2 people decide to click submit at the same time, at which point it does one of 3 things, either only writes the first one, only wites the second one....or renames the destination file with a tempory name with now extention, and writes nothing.

What im wondering is what would be the best way of ensuring both data sets write... maybe have an error catch if the files open that it writes to a temp file instead, maybe csv, then adds the values after a count of some sort? Any ideas?
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Oorang

Well-known Member
Joined
Mar 4, 2005
Messages
2,071
Then all you need to do is this:
On Error Resume Next
'The code that writes to the workbook here.
If Err.Number <> 0 then
Err.Clear
'Do whatever you want to do if the write fails.
End if
On Error Goto 0
 

Watch MrExcel Video

Forum statistics

Threads
1,118,673
Messages
5,573,594
Members
412,537
Latest member
Mohamed_5966
Top