Chdir doesn't work with UNC paths. There's an API that you could use to change
to that drive, but I don't think you need to in your code:
DefCatalogue = ThisWorkbook.Path
nFileNum = FreeFile
Open defCatalogue & "\" & "Message.txt" For Input Access Read As #nFileNum
side_ wrote:
Hello,
I have faced strange problem with the following code:
DefCatalogue = ThisWorkbook.Path
ChDir (DefCatalogue)
nFileNum = FreeFile
Open "Message.txt" For Input Access Read As #nFileNum
It was working fine when both workbook and Message.txt were located on
local drive. But when I have moved both files to network resource i.e.
"\\PC_3\shareddocs\Shared files\Tmp" the code breaks on file open
statement and it happens because ChDir does not make any changed to
default directory.
Does anyone have any ideas why it does not work?
--
side_
------------------------------------------------------------------------
side_'s Profile: http://www.excelforum.com/member.php...o&userid=19458
View this thread: http://www.excelforum.com/showthread...hreadid=540630
--
Dave Peterson