ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Folder..... (https://www.excelbanter.com/excel-programming/277321-create-folder.html)

PaiolaS

Create Folder.....
 
Hi.

I want to creat a folder in a specific path if this
folder doesn´t already exists
Im trying the following code but i just can get it to
work (and i dont understand the "OBJECT")

If Object.FolderExists(ThisWorkbook.Path & "\" & "Temp")
= False Then
MkDir ThisWorkbook.Path & "\" & "Temp"
End If

Thanks a lot
Paiolas

Ron de Bruin

Create Folder.....
 
Try this Paiolas

Sub MakeDirectory()
Dim Dirname As String
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dirname = "C:\Data"
If Not fs.FolderExists(Dirname) Then
fs.CreateFolder Dirname
' your code
Else
' your code
End If
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Paiolas" wrote in message ...
Hi.

I want to creat a folder in a specific path if this
folder doesn´t already exists
Im trying the following code but i just can get it to
work (and i dont understand the "OBJECT")

If Object.FolderExists(ThisWorkbook.Path & "\" & "Temp")
= False Then
MkDir ThisWorkbook.Path & "\" & "Temp"
End If

Thanks a lot
Paiolas




All times are GMT +1. The time now is 03:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com