View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Pete McCOsh Pete McCOsh is offline
external usenet poster
 
Posts: 64
Default why this code doesn't work?

Paolo,

not sure if it's a typo, but the line should read:

wkbk.Close SaveChanges:=false

rather than SaveChange:=False

Cheers, Pete
-----Original Message-----
Dear friends
Someone can tell me why the code "wkbk.Close

SaveChange:=False doesn't
work" in the macro below?
Is it possible to write the bklist in a different way

(more short)?
Thanks in advance

Sub Unisce_file()
bkList = Array("C:\Documents and
Settings\donello\Desktop\MACRO\vendite.xls", _
"C:\Documents and

Settings\donello\Desktop\MACRO\ordini.xls", _
"C:\Documents and

Settings\donello\Desktop\MACRO\bdg.xls", _
"C:\Documents and

Settings\donello\Desktop\MACRO\personale.xls", _
"C:\Documents and Settings\donello\Desktop\MACRO\mdc.xls")
For i = LBound(bkList) To UBound(bkList)
Set wkbk = Workbooks.Open(bkList(i))
If i = LBound(bkList) Then
wkbk.Sheets.Copy
Set wkbk1 = ActiveWorkbook
Else
wkbk.Sheets.Copy After:=wkbk1.Sheets(wkbk1.Sheets.Count)
End If
Next
wkbk1.SaveAs Filename:="C:\Documents and
Settings\donello\Desktop\MACRO\report.xls"
wkbk.Close SaveChange:=False
End Sub