View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Create directory

Here is a backup macro I use which should be of help. It will make the
directory if it doesn't already exist.

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub

--
Don Guillett
SalesAid Software

"Soniya" wrote in message
...
Hi,

How can i create a direcory using VBA if it do not exists?

for eg. when i click my command button i want to copy
sheet2,sheet3, sheet4 to c:\BkUp\FileName.. so that if
the direcory exixts it will save the file or create BkUp
directory and save the file ???

TIA
Soniya