VBA: Network Connection Macro Problem

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
The code below is what I am currently using. The problem Im having is that when there are no connections at all it throws up a error "Bad Name" and highlights the If Dir("H:\")
is there something I can add that I quess would check for any connection first then check for the H:
Thanks


Code:
[/COLOR]

If Dir("H:\") = "" Then
    UserForm1.Label1.Caption = "Error: No Network Connection..try again later"
Else
    UserForm1.Label1.Caption = "Network Connection Found ! Preparing to Send........"
End If
UserForm1.Show vbModeless
Application.Wait Now + TimeSerial(0, 0, 5)
Unload UserForm1[COLOR=#FF0000]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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