View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Andy Andy is offline
external usenet poster
 
Posts: 414
Default Macro that creates a directory but...

thanks...get the drift but still get the compile error on your first
statement...

"AA2e72E" wrote:

In your ThisWorkbook module, insert

Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll"
(ByVal lpPath As String) As Long

Sub xx()
MakeSureDirectoryPathExists "c:\aal\aam\aan\"
End Sub

and then run xx: you'll get the idea.

PS: Private is not necessary in a code module.

"Andy" wrote:

thanks...however get a compile error on the first line:

Compile error:

Only comments may appear after End Sub, End Function, or End Property


"AA2e72E" wrote:

Use:

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal
lpPath As String) As Long

MakeSureDirectoryPathExists "R:\Team 318\Toyota\Quotes\"

NOTE TRAILING \.


"Andy" wrote:

Hi

How do I create a macro to look into a directory and create a new directory
called "Quotes" only if one doesn't exist already.

eg

R:\Team 318\Toyota

would result in...

R:\Team 318\Toyota\Quotes

when run again, it wouldn't do anything, because the Quotes directory now
exists.