Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you sir, it worked.
Adnan "Chip Pearson" wrote: If you use the code at www.cpearson.com/Excel/BrowseFolder.aspx to display the dialog, you can use code like the following, Sub AAA() Dim FName As String FName = BrowseFolder("Choose A Folder") If Len(FName) < 0 Then Worksheets("Sheet1").Range("A1").Value = FName End If End Sub Where BrowseFolder is the procedure that displays the folder dialog. -- Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) "Adnan" (donotspam) wrote in message ... Ron, How do you write such code to call Dialog box to retrieve a folders path and input the path into cell A1 in Sheet1 (assuming there's a button next to this cell that would call this dialog)? I thank you for sharing your expertise with us, Adnan "Ron de Bruin" wrote: Hi Barb You can find code on this page to test http://www.rondebruin.nl/exist.htm One way is this Sub Test_Folder_Exist_FSO_Late_binding() 'No need to set a reference if you use Late binding Dim FSO As Object Dim FolderPath As String Set FSO = CreateObject("scripting.filesystemobject") FolderPath = "C:\My Folder" If Right(FolderPath, 1) < "\" Then FolderPath = FolderPath & "\" End If If FSO.FolderExists(FolderPath) = False Then FSO.CreateFolder (FolderPath) Else MsgBox "Folder exist" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Barb Reinhardt" wrote in message ... I'd like to test for a folder path (Z:\FolderName) and if it doesn't exist, I'd like to create it. Can someone provide a snippet of code on how to do this? Thanks, Barb Reinhardt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save file in a new folder, but create folder only if folder doesn't already exist? | Excel Programming | |||
Create Folder If It Doesn't Exist | Excel Programming | |||
How to: check if folder exist, if not, create | Excel Programming | |||
Test if folder exists, create if it doesn't? | Excel Programming | |||
Test if a folder exists, create if it doesn't? | Excel Programming |