View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Create new directory

Jim,

The text property of a range object is a text string, even if the value is a
date. It returns the cell as formatted. Your way is better though IMO as it
formats the date year first, which is better for sorting.

Bob

"Jim Thomlinson" wrote in message
...
Sebastien brings up an interesting point. If the value in C22 is a text
string then use his code to replace the slashes with dashes. If however,

as I
had assumed, the value is a date then the replace will not work and my

code
will... Depend on what you have...
--
HTH...

Jim Thomlinson


"sebastienm" wrote:

Francis,
you can use the mkdir statement. SOmething like (no tested):
'-----------------------------------
Dim s as string, path as string

path= "C:/Datefile/"

s=ThisWorksbook.sheets("MainPage").Range("C22").Te xt
s = replace(s, "/", "-") ' replace / with dash -

path= path & s ' <------ path string
makdir path
'------------------------------
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Francis Brown" wrote:

Hello.

How to you create a directory named the same as a date stored in a

cell.

say sheet MainPage has a date 25/10/2005 in cell C22.

How do you take this and make a Direcotry 22-10-2005 in C:/Datefile

folder.

Thanks in advance.

Francis.