![]() |
create a folder
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 |
create a folder
On error resume next
mkdir "C:\pswanie" On Error goto 0 -- Regards, Tom Ogilvy "pswanie" wrote: 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 |
create a folder
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 "Tom Ogilvy" wrote: On error resume next mkdir "C:\pswanie" On Error goto 0 -- Regards, Tom Ogilvy "pswanie" wrote: 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 |
create a folder
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 "pswanie" wrote: 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 "Tom Ogilvy" wrote: On error resume next mkdir "C:\pswanie" On Error goto 0 -- Regards, Tom Ogilvy "pswanie" wrote: 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 |
All times are GMT +1. The time now is 02:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com