Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
I create new Folder.
Private Sub Workbook_Open() Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End Sub but next time Workbook_Open if Folder "C:\Spelade" exist I want to Exit Sub How? Private Sub Workbook_Open() If ####Folder "C:\Spelade" exist#### Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End If End Sub /dalla -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
Try this dallas
Sub MakeDirectory() Dim Dirname As String Dim fs As Object Set fs = CreateObject("Scripting.FileSystemObject") Dirname = "C:\MyDir" If Not fs.FolderExists(Dirname) Then fs.CreateFolder Dirname Else ' do nothing End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "dallas " wrote in message ... I create new Folder. Private Sub Workbook_Open() Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End Sub but next time Workbook_Open if Folder "C:\Spelade" exist I want to Exit Sub How? Private Sub Workbook_Open() If ####Folder "C:\Spelade" exist#### Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolde End If End Sub /dallas --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
Dallas,
Try something like If Dir("C:\Spelade", vbDirectory) = "" Then Debug.Print "does not exist" Else Debug.Print "exists" End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "dallas " wrote in message ... I create new Folder. Private Sub Workbook_Open() Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End Sub but next time Workbook_Open if Folder "C:\Spelade" exist I want to Exit Sub How? Private Sub Workbook_Open() If ####Folder "C:\Spelade" exist#### Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End If End Sub /dallas --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
Private Sub Workbook_Open()
If Dir("C:\Spelade" ,vbDirectory) < "" Then Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "dallas " wrote in message ... I create new Folder. Private Sub Workbook_Open() Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End Sub but next time Workbook_Open if Folder "C:\Spelade" exist I want to Exit Sub How? Private Sub Workbook_Open() If ####Folder "C:\Spelade" exist#### Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End If End Sub /dallas --- Message posted from http://www.ExcelForum.com/ |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
Dallas, how about something like this
Private Sub Workbook_Open() If Dir("c:\Spelade", vbDirectory) = vbNullString Then _ MkDir "c:\Spelade" End Sub -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 97 ** remove news from my email address to reply by email ** "dallas " wrote in message ... I create new Folder. Private Sub Workbook_Open() Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End Sub but next time Workbook_Open if Folder "C:\Spelade" exist I want to Exit Sub How? Private Sub Workbook_Open() If ####Folder "C:\Spelade" exist#### Exit Sub Else Dim strMyFolder As String strMyFolder = "C:\Spelade" MkDir strMyFolder End If End Sub /dallas --- Message posted from http://www.ExcelForum.com/ |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
create new Folder
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create Folder Using VBA | Excel Discussion (Misc queries) | |||
Create Folder and Text File in folder | Excel Programming | |||
Create a Folder | Excel Programming | |||
Create Folder | Excel Programming | |||
Create Folder / Copy Folder / Replace | Excel Programming |