Thread: Workbooks.Close
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Workbooks.Close


I always use

set cd = workbooks.open(filename:=FName)

cd.close Savechanges:=true

Excel might not like CD because it is the command "Change Directory". Try a
different name!

"andim" wrote:

Hi everyone

I have a command button which takes the value of A20, opens another .xls
file and pastes the value in A20 of the new file (the new file has been
assigned to variable cd).

It is then supposed to close and save the new file with the following code:

Workbooks(cd).Close SaveChanges = True

But it doesn't save the changes. I don't know if it is because the command
button is in the first .xls file or not though.

Any Ideas?