Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create a folder.... (Post Duplicated?)
You got 2 answers,
-------------------------------------------------------------- An easy approach is to just attempt to create the folder. If it exists, the attempt fails, so you ignore the error - otherwise it is created: On Error Resume Next MkDir ThisWorkbook.Path & "\" & "Temp" On Error goto 0 -- Regards, Tom Ogilvy -------------------------------------------------------------- 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 -------------------------------------------------------------- -- HTH Bob Phillips "SpeeD72" wrote in message ... Hi I want to create a folder in a specific place, but the macro should only create it if the folder doesn´t exists. I´m using the folowing code, but it doesn´t work. Can anybody help me? If Object.FolderExists(ThisWorkbook.Path & "\" & "Temp") = False Then MkDir ThisWorkbook.Path & "\" & "Temp" End If thanks! P.S: My colegue tried to post several times this question (it just doesn´t appear!!) it´s possible that it might be duplicated now or in the future. sorry about that! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to create dialog box that will post to worksheet encoded data? | Excel Discussion (Misc queries) | |||
Create Folder Using VBA | Excel Discussion (Misc queries) | |||
post data to create a chart | Excel Discussion (Misc queries) | |||
Create a folder.... | Excel Programming | |||
Create Folder..... | Excel Programming |