Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Problem closing a workbook using a macro

The last part of my macro is a save command:

ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

The file is saved to its required location in csv format.

I then have a command that says ActiveWorkbook.Close,
however, this command will not work automatically. First
of all I get asked the question "Do you want to save the
changes you made to SIGINCUSTODY". After pressing Yes it
asks me to select the location where the file should be
saved. I select the file name as above (to where the file
has already been saved). I then asked do I want to
overwrite the file (as i have already saved it earlier in
the macro) and finally I get asked am I sure that I want
to save in csv format.

Is there anyway of just closing the file without being
asked all these questions ?

Thanks
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Problem closing a workbook using a macro

Hi Steve,

Is there anyway of just closing the file without being
asked all these questions ?


Su

ActiveWorkbook.Close SaveChanges:=False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Problem closing a workbook using a macro

Thanks Nikos and Jan
-----Original Message-----
Hi Steve,

Is there anyway of just closing the file without being
asked all these questions ?


Su

ActiveWorkbook.Close SaveChanges:=False

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Problem closing a workbook using a macro

Steve,

ActiveWorkbook.Close False

will close the workbook without prompting to save - and without saving, but
since you've only just saved, that should be OK.

HTH,
Nikos

"Steve" wrote in message
...
The last part of my macro is a save command:

ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

The file is saved to its required location in csv format.

I then have a command that says ActiveWorkbook.Close,
however, this command will not work automatically. First
of all I get asked the question "Do you want to save the
changes you made to SIGINCUSTODY". After pressing Yes it
asks me to select the location where the file should be
saved. I select the file name as above (to where the file
has already been saved). I then asked do I want to
overwrite the file (as i have already saved it earlier in
the macro) and finally I get asked am I sure that I want
to save in csv format.

Is there anyway of just closing the file without being
asked all these questions ?

Thanks
Steve



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
Set macro to run automatically when closing workbook? Wuddus Excel Discussion (Misc queries) 10 January 20th 15 03:39 PM
Closing Excel with Personal Macro Workbook [email protected] Excel Discussion (Misc queries) 6 November 7th 07 11:07 PM
CLosing Excel 2007 with personal macro workbook Kato Wilbur Excel Discussion (Misc queries) 3 March 13th 07 09:59 PM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM
Problem in closing Excel App with translated excel macro Dasharathi K Excel Programming 0 September 19th 03 08:35 AM


All times are GMT +1. The time now is 06:51 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"