View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Change directory

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!