create a folder

P

pswanie

i got a code to "save as" and overright a workbook. what i need is for it
to check if C:\pswanie\inventry does exist. if it does then the
code runs. if not i need to create that folder and insert inventry.xls
 
P

pswanie

just paste that? or how do i go about? this my macro....


Windows("editINVENTRY.xls").Activate
Sheets("inv 1st page").Select
ActiveSheet.Unprotect
Workbooks.Open Filename:= _
"C:\maykent\inventry\inventry.xls"
Sheets("inv 1st page").Select
Range("B14:T14").Select
Selection.Copy
Windows("editINVENTRY.xls").Activate
Range("B14:T14").Select
ActiveSheet.Paste

etc......

ending with....



ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False



ActiveWorkbook.SaveAs Filename:="C:\maykent\inventry\INVENTRY.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Application.Quit
 
T

Tom Ogilvy

On Error Resume Next
mkdir "C:\maykent"
mkdir "C:\maykent\inventry"
On Error goto 0

ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False



ActiveWorkbook.SaveAs Filename:="C:\maykent\inventry\INVENTRY.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Application.Quit

--
Regards,
Tom Ogilvy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top