Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear friends
Someone can tell me why the code "wkbk.Close SaveChange:=False doesn' 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 an 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 an Settings\donello\Desktop\MACRO\report.xls" wkbk.Close SaveChange:=False End Su -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
wkbk.Close SaveChanges:=False note the ending s in SaveChanges. In article , 71paolo71 wrote: Someone can tell me why the code "wkbk.Close SaveChange:=False doesn't work" in the macro below? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
use wkbk.Close SaveChanges:=False (you missed an 's'). You may also add the statement Option Explicit at the beginning of your module -- Regards Frank Kabel Frankfurt, Germany 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 --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The argument is SaveChanges not SaveChange.
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "71paolo71 " wrote in 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 --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Unisce_file()
sPath = "C:\Documents and Settings\donello\Desktop\MACRO\" bkList = Array("vendite.xls", _ "ordini.xls", _ "bdg.xls", _ "personale.xls", _ "mdc.xls") For i = LBound(bkList) To UBound(bkList) Set wkbk = Workbooks.Open(sPath & 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:=sPath & "report.xls" wkbk.Close SaveChange:=False End Sub -- Regards, Tom Ogilvy "71paolo71 " wrote in 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 --- Message posted from http://www.ExcelForum.com/ |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A little off topic, but just to share an idea. Personal preference would be
to factor out the long Directory. Again, just an idea. Sub Unisce_file() Const Base As String = "C:\Documents and Settings\donello\Desktop\MACRO\" bkList = Array("vendite.xls", "ordini.xls", "bdg.xls", "personale.xls", "mdc.xls") For i = LBound(bkList) To UBound(bkList) Set wkbk = Workbooks.Open(Base & bkList(i)) 'etc wkbk1.SaveAs Filename:=Base & "report.xls" End Sub -- Dana DeLouis Using Windows XP & Office XP = = = = = = = = = = = = = = = = = "71paolo71 " wrote in 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 --- Message posted from http://www.ExcelForum.com/ |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi friends
If I use the code "wkbk.Close SaveChanges:=False" the macro works (no error message) but unfortunately doesn't close th workbooks. Do I have to use another code? Someone can help me -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why does this code not work? | Excel Discussion (Misc queries) | |||
Why this code is not work? | Excel Worksheet Functions | |||
Code won't work? | Excel Programming | |||
Why my code do not work : - ( | Excel Programming | |||
Why my code do not work : - ( | Excel Programming |