1

I have a folder which is on a network like \\server\contents\tasks and I want to access this folder.

I am getting a "path not found" exception. What am I doing wrong here:

Dim FolderPath
FolderPath = "\\server\contents\tasks"
set FSO = CreateObject("Scripting.FileSyatemObject")
FSO.GetFolder(FolderPath)

Thanks

Edit: I found this post which answers the same thing I am trying to achieve, but the issue is I am getting an error the network share is no longer available. What I have is a local folder as a shared folder and mapped as \\servername\contents\tasks but it gives me the above error.

Edit: I was pointing at the wrong folder.

Now I have another issue trying to open a text file in the network folder. It is able to create a folder at the network path but throwing error while reading a text file in the network folder. Is there something else that needs to be done?

Set FSO = CreateObject("Scripting.FileSystemObject")
strOutputPath = strOutput1  --this is a network path
Set txsOutput = FSO.CreateTextFile(strOutputPath)
Set f = FSO.OpenTextFile(strInput1)
Community
  • 1
  • 1
user505210
  • 1,362
  • 11
  • 28
  • 50
  • Do you have access to `\\server\contents` with your current credentials? Can you open the path by pasting it into the Explorer address bar? Does `net view \\server` show the `contents` share? – Ansgar Wiechers Jul 01 '13 at 13:42
  • Try this solution: http://stackoverflow.com/questions/631401/access-network-share-from-within-vbscript-eg-filesystemobject – Mario Jul 01 '13 at 13:45
  • What *is* the error you're getting now? – Ansgar Wiechers Jul 01 '13 at 14:00
  • another path mistake..actually looping through a lot of folders and was getting that error at some of them since the path is constructed dynamically..Thanks for your help guys. – user505210 Jul 01 '13 at 14:15

1 Answers1

0

Open the network folder using explorer.exe and pass the location of the folder as a parameter (in this example it's sPath storing the folder path)

Example:

sPath = "\\somedrive.somecompany.ie\software"
Set oShell = CreateObject("WScript.Shell")
oShell.Run "explorer /n," & sPath, 1, False

Terms and conditions: username and password privileges already setup for acccess to the network folder.