View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default GetSaveAs Method

Just a heads up:
This will fail unless the lowest folder is the only one missing. You might
want to add code to protect for that.

--
Regards,
Tom Ogilvy


"Ron de Bruin" wrote in message
...
Try this

Sub MakeDirectory2()
Dim Dirname As String
Dim Answer As String
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dirname = "C:\MyDir"
If Not fs.FolderExists(Dirname) Then
Answer = MsgBox("Do you want to create a folder", vbOKCancel)
If Answer = vbOK Then
fs.CreateFolder Dirname
Else
'nothing
End If
Else
' do nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"MB" wrote in message

...
This is okay, but I want user input to confirm the new
directory name.
-----Original Message-----
Try this

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


"M. Barnes" wrote

in message ...
Is there a way to create the folder if the suggested

path
does not exist? In other words, search for the

suggested
folder first, if it doesn't exist, the system will
prompt "That folder does not exist, do you wish to

create
it?".

I've seen this happen in other programs, and desire to
add it to mine. I'm currently using the GetSaveAs
method, but am not sure if it is the best way.

Thanks for any help you can provide.


.