Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Close and save macro

Hi...

I'm struggling with some code...I want to hit a macro
button that will save changes, save the file to the
desktop and close excel...I'm close but no cigar.

Any help useful...

Cheers

Gordon.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Close and save macro

Gordon,

OKI< so show us what you've got and we'll go from there.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Gordon Cartwright" wrote in message
...
Hi...

I'm struggling with some code...I want to hit a macro
button that will save changes, save the file to the
desktop and close excel...I'm close but no cigar.

Any help useful...

Cheers

Gordon.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Close and save macro

I wouldn't close excel--the user might be working on lots of other files!

Option Explicit
Sub testme03()

Dim wsh As Object
Dim myPath As String

Set wsh = CreateObject("WScript.Shell")
myPath = wsh.SpecialFolders.Item("Desktop")

ActiveWorkbook.SaveAs Filename:=myPath & "\" & "whateveryouwant.xls", _
FileFormat:=xlWorkbookNormal

'Application.Quit
'or just close the activeworkbook
'ActiveWorkbook.Close savechanges:=False

End Sub

I think a lot of users would come looking for you if running your macro caused
them to lose work in other workbooks.

Gordon Cartwright wrote:

Hi...

I'm struggling with some code...I want to hit a macro
button that will save changes, save the file to the
desktop and close excel...I'm close but no cigar.

Any help useful...

Cheers

Gordon.


--

Dave Peterson

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 and close, then copy file NewSysAdmin Excel Discussion (Misc queries) 2 December 2nd 09 03:24 PM
How to code the Macro to save and close a file? Eric Excel Discussion (Misc queries) 7 June 10th 07 03:28 PM
Macro to save & close all opened files James A Excel Discussion (Misc queries) 1 December 23rd 06 05:16 AM
getting same save-on-close macro to work from different networklocations buczacz Excel Programming 0 September 12th 03 11:40 PM
getting same save-on-close macro to work from different networklocations buczacz Excel Programming 0 September 9th 03 05:48 AM


All times are GMT +1. The time now is 02:55 PM.

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

About Us

"It's about Microsoft Excel"