copy paste one workbook to another location WITHOUT opening

simple777

New Member
Joined
Jul 27, 2015
Messages
1
hey guys, new to this forum but have used your tips countless times!

trying to copy workbook A and paste in new location with slightly different name:

Getting Error Mismatch:

Set PREV_A= "fileA" & Format(WorksheetFunction.WorkDay(Date, -2), "yyyymmdd") & Format(WorksheetFunction.WorkDay(Date, -2), "yyyymmdd") & "AA.xlsb"
Set PREV_B = "fileB" & Format(WorksheetFunction.WorkDay(Date, -2), "yyyymmdd") & Format(WorksheetFunction.WorkDay(Date, -2), "yyyymmdd") & "BB.xlsb"
Set PREV_C= "fileC" & Format(WorksheetFunction.WorkDay(Date, -2), "yyyy mm dd") & ").xlsm"

Set NEW_A= "fileA_NEW" & Format(WorksheetFunction.WorkDay(Date, -1), "yyyymmdd") & Format(WorksheetFunction.WorkDay(Date, -1), "yyyymmdd") & "AA.xlsb"
Set NEW_B= "fileB_NEW" & Format(WorksheetFunction.WorkDay(Date, -1), "yyyymmdd") & Format(WorksheetFunction.WorkDay(Date, -1), "yyyymmdd") & "BB.xlsb"
Set NEW_C= "fileC_NEW" & Format(WorksheetFunction.WorkDay(Date, -1), "yyyy mm dd") & ").xlsm"

Workbooks("PREV_A").SaveCopyAs ("NEW_A")
Workbooks("PREV_B").SaveCopyAs ("NEW_B")
Workbooks("PREV_C").SaveCopyAs ("NEW_C")

End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi there,

source= location of source
Destination = location of destination
Code:
FileCopy source, destination
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top