Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can not change default folder to network resource


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can not change default folder to network resource

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Can not change default folder to network resource

Hi,

I am afraid that neither open works with UNC paths (the path must start
with a letter).

Regards,
Ivan

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can not change default folder to network resource

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Can not change default folder to network resource

Hi Dave,

you are right, I just tried open with UNC path and it works.

Thanks,
Ivan



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can not change default folder to network resource

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can not change default folder to network resource


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
... I'd like to change the Default Folder... Dr. Darrell Excel Discussion (Misc queries) 4 September 11th 07 04:12 PM
how can i change my default working folder to a networked folder? wizard1154 Excel Discussion (Misc queries) 4 April 18th 07 07:29 PM
How do you change default file location for Excel on a network? Fireman44 Setting up and Configuration of Excel 3 July 18th 06 07:25 AM
change curdir to a folder on a network [email protected] Excel Programming 2 October 9th 05 07:06 PM
Folder picker: default to network share? pk Excel Programming 0 October 11th 03 04:48 PM


All times are GMT +1. The time now is 10:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"