SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 6th, 2003, 05:23 PM
rrvball rrvball is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 rrvball User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
trying to restore current directory (curdir) for a folder on a network share

I have developed some Excel VB modules that update a workbook with data from text files. In order to have the macro use the directory of the last file(s) used to update the workbook, I saved the full filename of the last file in a workbook name. And then, when the user wished to update the workbook with new files, I read the name and use the ChDrive and ChDir commands to set the CurDir before calling the Application.GetOpenFilename procedure to have the user select the new files to use to update the workbook. This works great if the user selects a file using a drive or mapped drive where the full filename is in the form

D:\dir1\file1.ext

but, if the user selects the files using a network share, the full filename is in the form

\\network_share\dir1\file1.ext

And, the ChDrive function does not work. The ChDir function does not fail, but since it does not change the drive, the GetOpenFilename routine uses the current directory for whatever drive letter is current. I can not find a way to determine the current drive letter, but the function CurDir returns the current directory. Somehow, Excel is able to keep the CurDir set to a network share and unless it is changed, the GetOpenFilename will default to that folder. You can test this yourself by opening a file (use File:Open) on a network share, then go to an immediate window in VB and type "print curdir". It will respond with a current directory in the format for a network share as above. Then click the File:Open again and the default directory will be that folder. But, if you type ChDrive("C") in the immediate window and then click File:Open, it will default to some other directory on your C drive.

So, is there any other way to set the current directory and drive that allows a network share folder to be specified instead of a drive letter for the GetOpenFilename dialog?


Or, in other words, is there any way to get the GetOpenFilename dialog to default to a network share folder?

Thanks for your help,
Randy

Last edited by rrvball : August 6th, 2003 at 05:48 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > trying to restore current directory (curdir) for a folder on a network share


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway