How to check for an open Network connection in Excel VBA?

V

vrk1

I need to connect to an Access db on a Network File Server from my Excel VBA.
Please see my code below. Is there a better method instead of using a Shell
statement here? Someone told me Shell() statements are a lot of performance
overhead.

My question is:
1. Is there an alternate method to open a network connection instead of
using Shell statement.
2. Before opening a Network connection, I would like to check if this
network connection is open already. If it is, I dont want to do anything.
Otherwise, I would like to initiate a new connection.

If someone can throw some light here, I would really appreciate it.

Thanks.

___________________________
Sub test()

Shell ("net use \\fileserver\ipc$ /user:domain\uid pwd")

Set db = OpenDatabase("\\fileserver\share\folder\test.mdb", False, True, "MS
Access;PWD=12345")

other statements follow here.....

End Sub
 

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