Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2012, 08:21 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default Consolidate - does not work in 2007 version

I used a procedure to consolidate data from other excel files in the same directory. It ran under Excel2003, but in 2007 it does not - the command selection.consolidate ends with Run-time error '1004'. I spent hours to find any hint, but found nothing. Do you have any experience?

Jirik
Code:
Sub Konsolidace()
Sheets("Výsledovka").Select
ActiveSheet.Unprotect
Cesta = Application.Workbooks(ActiveWorkbook.Name).Path
Obd = Range("a1")
Range("e13").Select
Selection.Consolidate Sources:=Array( _
  Cesta + "\[F12_K00_Regiony.xlsm]Výsledovka!R13C5:R119C18", _
  Cesta + "\[F12-105151.xlsx]Výsledovka!R13C5:R119C18", _
  Cesta + "\[F12-120100.xlsx]Výsledovka!R13C5:R119C18", _
  Cesta + "\[F12_K_HQ.xlsm]Výsledovka!R13C5:R119C18"), _
  Function:=xlSum, TopRow:=False, LeftColumn:=False, CreateLinks:=False
Range("e164").Select
Selection.Consolidate Sources:=Array( _
  Cesta + "\[F12_K00_Regiony.xlsm]Výsledovka!R164C5:R164C18", _
  Cesta + "\[F12-105151.xlsx]Výsledovka!R164C5:R164C18", _
  Cesta + "\[F12-120100.xlsx]Výsledovka!R164C5:R164C18", _
  Cesta + "\[F12_K_HQ.xlsm]Výsledovka!R164C5:R164C18"), _
  Function:=xlSum, TopRow:=False, LeftColumn:=False, CreateLinks:=False
ActiveSheet.Protect
 
Range("a1").Select
End Sub


Last edited by macropod; 07-03-2012 at 04:33 AM. Reason: Added code tags
Reply With Quote
  #2  
Old 07-03-2012, 04:42 AM
macropod's Avatar
macropod macropod is offline Consolidate - does not work in 2007 version Windows 7 64bit Consolidate - does not work in 2007 version Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

hi Jirik,

Are you sure the source files are where they should be? Do they have the correct names and extensions? Have the source files been converted to the xls(x/m) formats?

FWIW, I believe your code could be made simpler and more efficient:
Code:
Sub Konsolidace()
Dim Cesta As String
Cesta = ThisWorkbook.Path
With Sheets("Výsledovka")
  .Unprotect
  .Range("E13").Consolidate Sources:=Array( _
    Cesta & "\[F12_K00_Regiony.xlsm]Výsledovka!R13C5:R119C18", _
    Cesta & "\[F12-105151.xlsx]Výsledovka!R13C5:R119C18", _
    Cesta & "\[F12-120100.xlsx]Výsledovka!R13C5:R119C18", _
    Cesta & "\[F12_K_HQ.xlsm]Výsledovka!R13C5:R119C18"), _
    Function:=xlSum, TopRow:=False, LeftColumn:=False, CreateLinks:=False
  .Range("E164").Consolidate Sources:=Array( _
    Cesta & "\[F12_K00_Regiony.xlsm]Výsledovka!R164C5:R164C18", _
    Cesta & "\[F12-105151.xlsx]Výsledovka!R164C5:R164C18", _
    Cesta & "\[F12-120100.xlsx]Výsledovka!R164C5:R164C18", _
    Cesta & "\[F12_K_HQ.xlsm]Výsledovka!R164C5:R164C18"), _
    Function:=xlSum, TopRow:=False, LeftColumn:=False, CreateLinks:=False
  .Protect
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-13-2012, 07:40 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default

Hi Paul,

I made a special example for you - I left only 2 files for consolidation, each file contains only one sheet. Enclosed you will find 3 files in version 2003, and 3 files in version 2007. You can run macro inside the main file : the version 2003 works, 2007 not.
I will appreciate any idea, any hint...

Jiri

P.S. my code is not optimized, but I will use your corrections with pleasue when the main topic works...
Attached Files
File Type: zip test.zip (858.6 KB, 8 views)
Reply With Quote
  #4  
Old 07-13-2012, 01:57 PM
macropod's Avatar
macropod macropod is offline Consolidate - does not work in 2007 version Windows 7 64bit Consolidate - does not work in 2007 version Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It works OK with your xlsx workbooks (I use Office 2010) - I haven't tried with the xls workbooks. Are you sure your Office 2007 is fully updated? Have you tried repairing Office 2007 (Excel Options|Resources|Diagnose)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-18-2012, 12:47 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default

Hi Paul,

Thanks for your tip, I passed the diagnose procedure, there was one item wrong and it was solved (by the diagnose utility), but it did not help.
In any case I will upgrade to 2010 version next week, I will inform you about the situation after it.

Jirik
Reply With Quote
  #6  
Old 08-06-2012, 06:08 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default

Hi Paul,

I have upgraded to 2010 version, but there is no change - the macro stops at command consolidate - the error message is enclosed in jpg. Do you have any hint what to test now? I tried to find a similar repair procedure in Exc2010 (like you recommend for 2007), but I found none

Jirik
Attached Images
File Type: jpg Errormessage.JPG (63.9 KB, 6 views)
Reply With Quote
  #7  
Old 08-07-2012, 12:14 AM
macropod's Avatar
macropod macropod is offline Consolidate - does not work in 2007 version Windows 7 64bit Consolidate - does not work in 2007 version Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As I said, the code worked fine for me. Also as per my first post:
Quote:
Are you sure the source files are where they should be?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 08-07-2012, 07:33 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default

Unfortunately yes, they are all in the same directory...

Jirik
Reply With Quote
  #9  
Old 08-07-2012, 07:55 PM
macropod's Avatar
macropod macropod is offline Consolidate - does not work in 2007 version Windows 7 64bit Consolidate - does not work in 2007 version Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jirik,

If you press Debug when the error occurs, which code line is highlighted?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 08-08-2012, 04:10 AM
Jirik61 Jirik61 is offline Consolidate - does not work in 2007 version Windows XP Consolidate - does not work in 2007 version Office 2007
Novice
Consolidate - does not work in 2007 version
 
Join Date: Apr 2012
Posts: 8
Jirik61 is on a distinguished road
Default

Hello Paul,

the line with command consolidate - see enclosed jpeg.

Jiri
Attached Images
File Type: jpg Errormessage VB.JPG (67.7 KB, 8 views)
Reply With Quote
  #11  
Old 08-08-2012, 04:59 AM
macropod's Avatar
macropod macropod is offline Consolidate - does not work in 2007 version Windows 7 64bit Consolidate - does not work in 2007 version Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Curious. The code works fine for me. I'd be surprised if repairing Excel would change anything, but you can do this via 'Programs & Features' in the Windows Control Panel. The only other thing I can think of is that a 3rd-party addin that you might be running is interfering with the code's execution.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Consolidate - does not work in 2007 version Is there a portable version of MS Project 2007? pstein Project 1 03-26-2012 07:37 AM
Word 2010: new document opens as 2007 version DigiCat Word 0 02-29-2012 11:51 AM
Consolidate - does not work in 2007 version This macros are not working in office english version 2007 hans Excel Programming 4 12-10-2011 07:03 AM
problem opening document in word 2007 version Lavanya Word 1 05-28-2010 03:40 AM
Consolidate - does not work in 2007 version Which Version of Office 2007 to Buy? FauxAsian Office 1 03-25-2010 09:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft