View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jeff Jeff is offline
external usenet poster
 
Posts: 921
Default Change directory

The problem I was having was if there was a folder with no files in it.

My first step was to create a new folder and then populate it, but it is a
problem here because there are no files there yet.

Any suggestions?


"Gary''s Student" wrote:

Your code (which works) results in myFileName containing something like:

C:\Temp\Inside\whatever.xls

a string with the full path and file name. You can get the individual parts
by splitting the string on the last backslash.
--
Gary's Student


"Jeff" wrote:

Hi,

I was using the ChDir = "C:\Temp" to change the directory
Is there anyway to specify the directory, and then save the path as a
string. I was trying.

myFileName = Application.GetOpenFilename("Excel Files, *.xls")
y = Dir(myFileName, vbDirectory)

but y was just set to the filename, I wanted the path like "C:\Temp"

Thanks for your help!