Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default why this code doesn't work?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default why this code doesn't work?

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
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
Why does this code not work? rk0909 Excel Discussion (Misc queries) 12 September 4th 08 10:42 PM
Why this code is not work? Error code when select worksheet Excel Worksheet Functions 4 December 4th 07 12:51 AM
Code won't work? Joe 90 Excel Programming 3 October 2nd 03 04:26 AM
Why my code do not work : - ( Tom Ogilvy Excel Programming 1 August 31st 03 04:53 PM
Why my code do not work : - ( Bob Phillips[_5_] Excel Programming 0 August 31st 03 01:27 PM


All times are GMT +1. The time now is 02:04 AM.

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

About Us

"It's about Microsoft Excel"