Open, Copy, Close spreadsheet w/o Dialog boxes

kotiaspen

New Member
Joined
Sep 11, 2002
Messages
9
I am trying to set up a macro that will open a spreadsheet, copy a selection, then paste the selection into a different file, then close the file where the information came from. I got the macro to work, but is there a way to force excel not to ask to save changes or keep information on the clipboard. thanks for any help, I have included a copy of the vba.

ChDir "c:Test"
Workbooks.Open Filename:="c:TestSales Report.xls", UpdateLinks _
:=0
Range("L25:O97").Select
Selection.Copy
Windows("Summary.xls").Activate
Range("L25:O25").Select
ActiveSheet.Paste
Range("L25:O25").Select
Windows("Sales Report.xls").Activate
ActiveWindow.Close
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
The following line will close the active workbook without any fuss

ActiveWorkbook.Close Savechanges:=False

Good luck!
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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