• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA - Wait until other users close the file

ShawnExcel

Member
Hello! I have created a 'reporting' system where 100 people all use an excel form saved to their computer, and when they hit "submit" it opens another .xlsb file in a shared drive, finds the next line, and puts the data on the next line. This all takes 2-5 seconds to complete, however, if two people hit "submit" at the same time then one gets an error that the file is already open.

I am trying to write VBA that does the following:
1) Check if Database.xlsb is open by another user
2) If not, continue with the code
3) If yes (file is not available), then wait 5 seconds and try again, wait 5 more seconds and try again, wait 5 more seconds and try again, display msgbox "Could not submit data, please try again in a few minutes (then exit sub)

I have found numerous example of code with the "FileIsFree" or "FileIsOpen" variables, however my Excel 2010 says that is not working. Thank you in advance for the help!
 
Does "IsFileOpen" work in 2010 and beyond, or only earlier versions? I can't seem to get it working in 2010. Also - Marc, I could not agree more! I would love if this were all in access, however people here are incredibly scared of access and I was told no. Can I have an excel spreadsheet open up a shared access database and paste it in the next line?
 
Other free/Opensource databases, if you can have a server house the database.

MS SQL (up to 10 GB of data)
mysql
PostgreSQL

For ease of use, I'd go with MS SQL or Access. Though I'm required to use mysql often as many small companies use mysql as go to option for their database need.
 
My company has 60,000 + employees....you'd think we would have this figured out, but clearly not! Only 200 (eventually) will be using this software. My current plan is to use excel until November 1st and then transfer it to Access as you posted above. I can go into my current database, add a note to cell AA2, and that message will pop up for all users trying to submit data. I was proud of that! But I'm also new to Excel, VBA, and all this fun stuff.

I will try to use the options you showed above and report back shortly! You all rock!
 
Hmmmm looks like I don't have IsFileOpen built into my Excel library. I keep getting an error: "Compile Error: Sub or Function not defined" - internet research shows others have this problem and I can't find any way to fix it. Anyone else run into this?
 
Did you copy the code in the link I gave you and paste it into regular module? It's not built in function.
 
Back
Top