View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Martin Fishlock[_3_] Martin Fishlock[_3_] is offline
external usenet poster
 
Posts: 59
Default Make new folder & save to it

Try this:

Function CreateFolder(folder As String) As String
Dim p As Variant
On Error GoTo Err
CreateFolder = ""
p = ActiveWorkbook.Path ' CurDir of active workbook<<<<<<<<<<<<
If Len(p) 0 Then
If Right(p, 1) < "\" Then p = p & "\"
p = p & folder
MkDir p
CreateFolder = p
End If
Err:
End Function


--
HTHs Martin


"krabople" wrote:


Hi, thanks again for the code, it works great. The only problem is that
it creates the folder in My Documents for some reason whereas I need
the folder to be in the same directory as the active workbook. How do I
do this?


--
krabople
------------------------------------------------------------------------
krabople's Profile: http://www.excelforum.com/member.php...o&userid=29774
View this thread: http://www.excelforum.com/showthread...hreadid=504845