Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Closing file with macro

I would like to automatically close a file without saving using a macro. Any
suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Closing file with macro

Dim wkbk as workbook

Set wkbk = workbooks("someworkbooknameherethat'salreadyopen.x ls")

wkbk.close savechanges:=false



dwake wrote:

I would like to automatically close a file without saving using a macro. Any
suggestions?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Closing file with macro

You can record a macro that will copy all of the movements. To record the
macro, go to Tools == Macro == Record Macro. That will pull up the Record
Macro window, name your macro, and give it a shortcut key if you want. Once
you hit ok, all of your movements will be recorded until you hit the stop
macro button. All you need to do is close the file without saving and stop
the macro.

"dwake" wrote:

I would like to automatically close a file without saving using a macro. Any
suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Closing file with macro

Might be a good idea to record the macro in some other workbook than the one
you're closing without saving<g

When you record to new workbook all you get from the recorder is

Sub Macro3()
ActiveWorkbook.Close
End Sub

Which closes the original workbook with a "do you want to save" message.

So you would have to add the bits that Dave posted.


Gord Dibben MS Excel MVP



On Tue, 1 Dec 2009 16:10:01 -0800, Bryan
wrote:

You can record a macro that will copy all of the movements. To record the
macro, go to Tools == Macro == Record Macro. That will pull up the Record
Macro window, name your macro, and give it a shortcut key if you want. Once
you hit ok, all of your movements will be recorded until you hit the stop
macro button. All you need to do is close the file without saving and stop
the macro.

"dwake" wrote:

I would like to automatically close a file without saving using a macro. Any
suggestions?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Save File to specific location when closing paankadu Excel Discussion (Misc queries) 3 October 26th 09 11:52 PM
How to skip the save file notoification on file closing? Dan Excel Worksheet Functions 1 August 19th 07 02:26 PM
How to code on Macro on saving and closing a file? Eric Excel Worksheet Functions 1 June 10th 07 01:32 PM
macro closing worksheet Jeff Excel Discussion (Misc queries) 1 July 3rd 06 01:58 PM
Help with auto macro on closing mr_teacher Excel Discussion (Misc queries) 3 May 17th 06 01:07 PM


All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"