| myFile = "C:\Billing\Invoices\SepInv\"
| myDir = Dir(myFile)
| If myDir <> "" Then
| MsgBox "Directory already exists"
This does not work if the folder is empty...
It's better if you use this : myDir = Dir(myFile, vbDirectory)
"WhytheQ" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
an old post by Bob Philips says:
'################################
1. Use DIR to test, and FileSystemObject to create it
Dim myDir, myFile
myFile = "C:\Billing\Invoices\SepInv\"
myDir = Dir(myFile)
If myDir <> "" Then
MsgBox "Directory already exists"
Else
myDir =
CreateObject("Scripting.FileSystemObject").createFolder(myFile)
End If
2. Use FileSystemObject for both
Dim myDir, myFile
myFile = "C:\Billing\Invoices\SepInv\"
myDir =
CreateObject("Scripting.FileSystemObject").FolderExists(myFile)
If myDir = True Then
MsgBox "Directory already exists"
Else
myDir =
CreateObject("Scripting.FileSystemObject").createFolder(myFile)
End If
'#######################################
I'm sure the above must help
Rgds
J
On 29 Nov, 12:41, "HH" <j...@mail2hansen.dk> wrote:
> Hi'
>
> I have a macro copying files to specifik folders. I only have one
> problem, if the folder is not created then the script stops.
>
> How do I let the script ignore this file and just move on to the next?
> I
> suppose i need to check if the destination folder exist, but how?
>
> Thanks