Test if a file is open

M

MartyO

How can I (with VBA in a form module in MS Access) test if an Excel file is
open by another user, before my code launches the Transfer Spreadsheet
command. I'm importing data from the spreadsheet to my mdb, and get "file is
locked by another user" if the spreadsheet is open at the time another user
opens the form that executes the Transfer Spreadsheet command (it's on the
OnOpen event of the form).
Or is there a better way to get that data into my mdb, where folks won't
bump up against each other.
Thanks in advance!
Marty
 
J

Jonathan West

MartyO said:
How can I (with VBA in a form module in MS Access) test if an Excel file
is
open by another user, before my code launches the Transfer Spreadsheet
command. I'm importing data from the spreadsheet to my mdb, and get "file
is
locked by another user" if the spreadsheet is open at the time another
user
opens the form that executes the Transfer Spreadsheet command (it's on the
OnOpen event of the form).
Or is there a better way to get that data into my mdb, where folks won't
bump up against each other.
Thanks in advance!
Marty

How to check if a file has already been opened by another user
http://www.word.mvps.org/FAQs/MacrosVBA/CheckIfFileOpen.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top