ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create directory (https://www.excelbanter.com/excel-programming/287714-create-directory.html)

Soniya[_2_]

Create directory
 
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

Don Guillett[_4_]

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





All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com