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 Test if a folder exists

You macro will raise an error if it tries to make the folder and it already
exists. However, it is easiest to just trap the error and move on.

On Error Resume Next
mkdir "C:\Billing\Invoices\SeptInv"
On Error goto 0

' at this point you know it exists.

this assumes "C:\Billing\Invoices" exists. If you can't assume that

On Error Resume Next
mkdir "C:\Billing"
mkdir "C:\Billing\Invoices"
mkdir "C:\Billing\Invoices\SeptInv"
On Error goto 0



--
Regards,
Tom Ogilvy

Jeff Marshall wrote in message
...
Hi,

I am making a folder using VBA called "SeptInv" in C:\Billing\Invoices\ .

However before the folder is made I don't know how to;

1. Test if the SeptInv folder has already been made and
2. Once it has been made that my VBA macro doesn't try to make it again.

Thanks in advance for any help.
Jeff