0

I have a particular file which needs to be sent to a share drive location through FTP.

I know there is a method by writing contents on a flat file and executing with shell script. Sadly that is not working since my send location is weird and I don't know how to interpret it, its like this.

//corporate.abc.com/data/ac/ny/log

I have no idea what the above thing means. Is there any way to send data to that location?

PS: I opened it through my Windows Run command and its opening up. It is not asking for any user authentication.

Update: I tried to open using explorer but I am getting error" runtime error 75 , path/file access error"

Sub FtpFileto() 
Dim vFile As String
Dim vFTPServ As String
Dim fNum As Long
vPath = "C:\macro/pop.txt"
vFile = "C:\macro/post.xlsx"
vFTPServ = "corporate.abc.com" 
Open "//corporate.abc.com/data/NA/US/OC/Common/HOSTDL/CatSpec" For Output As #1
Close
Shell "ftp -n -i -g -s:" & vPath & "\FtpComm.txt " & vFTPServ, vbNormalNoFocus
End Sub
Anarach
  • 440
  • 2
  • 16
  • 35

1 Answers1

1

If the UNC path can be opened in Windows Explorer, it means that it is directly accessible and can be worked with as if it were a local path.

Open "\\corporate.abc.com\data\ac\ny\log\test.ext" For Output As #1
Write #1, Data
Close #1

You do not need (cannot) use FTP to work with it.


Note that the UNC is a Windows convention, so it uses backslashes, not forward slashes (though in many cases Windows will accept the forward slashes too).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thank you for your answer but when i use your code i am getting runtime error 75. Path file access error – Anarach Sep 15 '15 at 09:49
  • Is the `CatSpec` a file or folder? Did you try using backslashes? – Martin Prikryl Sep 15 '15 at 11:38
  • Yeah , its working, but not through your method, I simply put "SAVE AS "address" and it worked . Thanks for the idea of saving without ftp , kindly edit your answer and i will accept it :-) – Anarach Sep 15 '15 at 11:41
  • What is "Save as address"? – Martin Prikryl Sep 15 '15 at 11:45
  • ActiveWorkbook.SaveAs Filename:="//corporate.abc.com/ac/af/test.xls" – Anarach Sep 15 '15 at 12:07
  • You use a different path every time. That makes it difficult to help you. But I assume that the `log` is a directory name, so you should have used `Open "\\corporate.abc.com\data\ac\ny\log\test.ext" For Output As #1`. – Martin Prikryl Sep 15 '15 at 12:26