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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi kotiaspen

Try Application.DisplayAlerts=Falseat the start of your routine.

(Remember to switch back to True again at the end of your code)

HTH
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,287
Members
448,562
Latest member
Flashbond

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