#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default mkdr

Hi,

Im having problems using the mkdir command in my macro. I want to make the
directory specidied in a cell (as the path changes dependant upon date
etc..)

I have set the value of this cell to "fname" in my macro, and have used "if
fname doesnt exist then mkdir fname (obviously in code).

This has the effect of creating a directory "fname" in the last directory I
had open, not the directory specified in the cell.

Could this be anything to do with the fact that the cell with the path is
actually a formula?

Hope this makes sense!

TIA

Matt




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default mkdr

Matt,

Post the code that is causing the problem.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Matt B" wrote in message
...
Hi,

Im having problems using the mkdir command in my macro. I want

to make the
directory specidied in a cell (as the path changes dependant

upon date
etc..)

I have set the value of this cell to "fname" in my macro, and

have used "if
fname doesnt exist then mkdir fname (obviously in code).

This has the effect of creating a directory "fname" in the last

directory I
had open, not the directory specified in the cell.

Could this be anything to do with the fact that the cell with

the path is
actually a formula?

Hope this makes sense!

TIA

Matt






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default mkdr

sounds like your entry in fname does not include a full path


You need to include full path or change to the drive & folder where the
sub folder is to be created


My formula entered into cell named fName
="c:\Temp\"&TEXT(TODAY(),"yy-mm-dd")


Sub MakeDir()
Dim fPath As String

' may need place change directory code here

fPath$ = Range("fName").Value
If Dir(fPath, vbDirectory) = "" Then
MkDir (fPath)
End If
End Sub


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default mkdr

Matt,

Check your PC time settings too.
They're off by about 8 hours.
Maybe your time zone is set wrong.

John

"Matt B" wrote in message
...
Hi,

Im having problems using the mkdir command in my macro. I want to make

the
directory specidied in a cell (as the path changes dependant upon date
etc..)

I have set the value of this cell to "fname" in my macro, and have used

"if
fname doesnt exist then mkdir fname (obviously in code).

This has the effect of creating a directory "fname" in the last directory

I
had open, not the directory specified in the cell.

Could this be anything to do with the fact that the cell with the path is
actually a formula?

Hope this makes sense!

TIA

Matt






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"