Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 o 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 ope statement and it happens because ChDir does not make any changed t default directory. Does anyone have any ideas why it does not work -- side ----------------------------------------------------------------------- side_'s Profile: http://www.excelforum.com/member.php...fo&userid=1945 View this thread: http://www.excelforum.com/showthread.php?threadid=54063 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am afraid that neither open works with UNC paths (the path must start with a letter). Regards, Ivan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you sure?
I don't have the ability to test that anymore, but that's not the way I recall. Ivan Raiminius wrote: Hi, I am afraid that neither open works with UNC paths (the path must start with a letter). Regards, Ivan -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dave,
you are right, I just tried open with UNC path and it works. Thanks, Ivan |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for posting back with your test results.
Ivan Raiminius wrote: Hi Dave, you are right, I just tried open with UNC path and it works. Thanks, Ivan -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for you help. Regards, Side -- side_ ------------------------------------------------------------------------ side_'s Profile: http://www.excelforum.com/member.php...o&userid=19458 View this thread: http://www.excelforum.com/showthread...hreadid=540630 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
... I'd like to change the Default Folder... | Excel Discussion (Misc queries) | |||
how can i change my default working folder to a networked folder? | Excel Discussion (Misc queries) | |||
How do you change default file location for Excel on a network? | Setting up and Configuration of Excel | |||
change curdir to a folder on a network | Excel Programming | |||
Folder picker: default to network share? | Excel Programming |