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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

manney

New Member
Joined
Mar 25, 2002
Messages
46
The following line will close the active workbook without any fuss

ActiveWorkbook.Close Savechanges:=False

Good luck!
 

Forum statistics

Threads
1,144,734
Messages
5,725,982
Members
422,652
Latest member
Elnene1

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
Top