View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ludo Ludo is offline
external usenet poster
 
Posts: 74
Default change local drive / folder to network folder

Hi,

I need to read data from various excel files on a netwerk connected
PC.
I can read the info when nothing goes wrong with the filename, but if
there's a typo in the filename (manual input), this one can't be found
on the network PC, so i reply with a messagebox with a selection
Retry / Cancel.

When Retry is selected, i change the default drive to the network
location where the file resides so that the files in the xlDialogOpen
are the ones in this location, but it won't work.

i get an " Run-time error '5' " - " Invalid procedure call or
argument"

The network location is something like this :

\\Kndclt21079\F TMG\Cat\Ate_Hass1\Logging\HASS_PowerMeasurements\

this is part of the code i use:

Dim CurFolder As String
Dim NewFolder As String

CurFolder = CurDir
..
..
..


'open dialog to select TMG file
NewFolder = KastNummer '= \\Kndclt21079\F TMG\Cat
\Ate_Hass1\Logging\HASS_PowerMeasurements\
ChDrive NewFolder
ChDir NewFolder

dlgAnswer = Application.Dialogs(xlDialogOpen).Show
'change back
ChDrive CurFolder
ChDir CurFolder
Exit Sub


Any help apreciated.
Thanks in advance
Ludo