I am writing a macro in Excel and I am trying to save a .txt file to a share drive. I have tried both sets of code below and I get ‘Run-time error ’76’: Path Not Found”. Is this the correct syntax for file path?
FilePath = ThisWorkbook.Path & "\\server.name\$foldername"
sOutPutFile = "filename.txt"
FilePath = "\\server.name\$foldername"
sOutPutFile = "filename.txt"
I get the error on the following line:
Open FilePath & sOutPutFile For Output As #nFileNum
Any thoughts? Thanks in advance.
It looks like you need a “\” between FilePath and sOutPutFile: