Checking the connection to a network Share
I have a VBA macro that write to a network share however I have two problems.
1: The user is prompted to enter a username and password. I would like to place this in the macro. 2: I can't reference the computer with the shared folder by name and need to use the IP address. I would like to check the connection to the share before copying the file. In the past I use code like this: Dim Coll_Docs As New Collection Dim strSearch_path, strSearch_Filter, strSearch_Fullname As String Dim strDocName As String strSearch_path = strSharePath strSearch_Filter = "*.*" 'what files Set Coll_Docs = Nothing strDocName = Dir(strSearch_path & "\" & strSearch_Filter) Do Until strDocName = "" ' build the collection Coll_Docs.Add Item:=strDocName strDocName = Dir Loop intShareTest = Coll_Docs.Count it is a crude but if intsharetest is 0 then it has connected to the drive and sees the other files in the shared folder. This works if strSharePath ="//conputername/foldername" but doesnt work using "//ipaddress/foldername". I need a test that uses the IP address. Thanks, -- KC |
All times are GMT +1. The time now is 12:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com