Thread: Update CurDIr??
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Update CurDIr??

If curdir doesn't give the correct answer, then:

thisworkbook.Path gives the path of the workbook executing the code.

application.Path the location of the Excel.exe file

Activeworkbook.path of the workbook that is active.

Application.DefaultFilePath gives the default path used for files when
excel is first started. (found in Tools=Options=General Tab, "default file
location""



Perhaps you can use one of those.

--
Regards,
Tom Ogilvy


"Nick M" wrote:

That would be ideal, but this is for a somewhat standardized process that has
to be able to be moved depending on when it is used.

"Tom Ogilvy" wrote:

curdir returns the current directory for the default drive.

Why not just spell out where you want to open the file

Workbooks.Open Filename:="S:\Myfolder\Filename.xls"

--
Regards,
Tom Ogilvy


"Nick M" wrote:

I have written the following code to open a file:

Workbooks.Open Filename:=CurDir & "\FILENAME.XLS"

This was created in a folder on my hard drive, but now that I have moved
everything to a network drive I get errors saying that the file does not
exist because the location is still saved as my hard drive folder.

Is there a command I should be using to update everything before running, or
maybe a better way to name the files that I should be using?


Thanks,
Nick M