View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Macro to save and close, then copy file

Kind of hard for excel to do anything after closing...

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"NewSysAdmin" wrote in message
...
I've created a button with a macro assigned to it. I'm trying to save and
close an Excel file, then close the application. Then I would like to
copy
it to another location (to do a type of sync operation). The user would
click the button each time they make changes. The code below is not
copying
the file to the new location. Can anyone help me? Thank you so much.

Sub Rectangle1_Click()

Dim FromFileName As String
Dim ToFileName As String

Workbooks("Book1.xls").Save
Workbooks("Book1.xls").Close
Application.Quit

FromFileName = "C:\Ole\Book1.xls"
ToFileName = "C:\Blue\Book1.xls"
FileCopy Source:=FromFileName, Destination:=ToFileName


End Sub