ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MkDir and Save As (https://www.excelbanter.com/excel-programming/318662-mkdir-save.html)

wtpcomplab

MkDir and Save As
 
If I use the MkDir command to make a new folder then use the save as command
to save an open file under a different name,
how do I change the save as code to direct the new file to save in the new
folder?


Dan

' Variable FolderNme
' Variable FstNme
' Variable LstNme

FolderNme = "C:\Documents and Settings\All Users\" & _
"Documents\OFFICE SKILLS\" & (FstNme & " " & LstNme)
On Error Resume Next
MkDir FolderNme
On Error GoTo 0

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls"

' Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
' "C:\Documents and Settings\All Users\" & _
' "Documents\OFFICE SKILLS\" & _ (FolderNme) & _
' "Invoice_AND_Total_Sheet.xls"

Tom Ogilvy

MkDir and Save As
 
Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls"

Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
FolderNme & _
"\" & "Invoice_AND_Total_Sheet.xls"

--
Regards,
Tom Ogilvy

"wtpcomplab" wrote in message
...
If I use the MkDir command to make a new folder then use the save as

command
to save an open file under a different name,
how do I change the save as code to direct the new file to save in the new
folder?


Dan

' Variable FolderNme
' Variable FstNme
' Variable LstNme

FolderNme = "C:\Documents and Settings\All Users\" & _
"Documents\OFFICE SKILLS\" & (FstNme & " " & LstNme)
On Error Resume Next
MkDir FolderNme
On Error GoTo 0

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls"

' Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
' "C:\Documents and Settings\All Users\" & _
' "Documents\OFFICE SKILLS\" & _ (FolderNme) & _
' "Invoice_AND_Total_Sheet.xls"




wtpcomplab

MkDir and Save As
 

Thank's :)


"Tom Ogilvy" wrote:

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls"

Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
FolderNme & _
"\" & "Invoice_AND_Total_Sheet.xls"

--
Regards,
Tom Ogilvy

"wtpcomplab" wrote in message
...
If I use the MkDir command to make a new folder then use the save as

command
to save an open file under a different name,
how do I change the save as code to direct the new file to save in the new
folder?


Dan

' Variable FolderNme
' Variable FstNme
' Variable LstNme

FolderNme = "C:\Documents and Settings\All Users\" & _
"Documents\OFFICE SKILLS\" & (FstNme & " " & LstNme)
On Error Resume Next
MkDir FolderNme
On Error GoTo 0

Workbooks.Open Filename:= _
"C:\Documents and Settings\All Users\Documents\" & _
"OFFICE SKILLS\Invoice_AND_Total_Sheet.xls"

' Workbooks("Invoice_AND_Total_Sheet.xls").SaveAs _
' "C:\Documents and Settings\All Users\" & _
' "Documents\OFFICE SKILLS\" & _ (FolderNme) & _
' "Invoice_AND_Total_Sheet.xls"






All times are GMT +1. The time now is 03:03 PM.

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