Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create dialog box that will post to worksheet encoded data? joromajr Excel Discussion (Misc queries) 1 November 1st 09 12:16 PM
Create Folder Using VBA DoooWhat Excel Discussion (Misc queries) 5 September 21st 07 10:28 PM
post data to create a chart Dave Newman Excel Discussion (Misc queries) 1 March 28th 07 02:16 PM
Create a folder.... Paiolas Excel Programming 0 September 17th 03 08:20 PM
Create Folder..... Paiolas Excel Programming 1 September 17th 03 06:39 PM


All times are GMT +1. The time now is 04:22 PM.

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

About Us

"It's about Microsoft Excel"