![]() |
#1
|
|||
|
|||
![]()
Awhile back I switch to Windows 10 and Excel 2016 from Windows 7 Office 12. No major problems until a new user is still running Win7 & Office 2007.
I've read that I should work in Excel 2016 and simply reference Office 12 Object library in the References - VBAproject dialog. So, I've found the Office 12 folder on my Windows 7 machine and put a copy into C:\Program Files (x86)\Microsoft Office on the Win 10 machine, exactly where the Office 16 folder is. Now, here's the problem. The References - VBAproject Browse dialog is looking for a specific dll, not a folder with a bunch of them. If I know exactly which one (or ones) I needed, that would be OK. But I don't know that. My VBA probably uses a lot of them and I don't know exactly which one is causing my app to crash when run on a Win 7 Office 12 machine. What am I missing? Ed |
#2
|
||||
|
||||
![]()
Stop!
Simply copying the Office 12 folder to your Office 2016 PC won't work. Evidently, you're doing some form of automation and your code uses early binding. To continue using that, you should compile the project on a PC using the earliest version of Office you're required to support; otherwise switch to late binding.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thanks, Paul. I'm trying to do what your saying. After putting the Office 2012 folder on my current development PC at C:\Program Files (x86)\Microsoft Office (where Office 16 is) I am trying to add it to it with the References - VBAproject dialog. I.E., Early binding with the earlier version of the object libraries. However, I can't figure out how to do it because the Browser button in that dialog won't allow selection of a folder. It's filter allows only .dll and the like.
|
#4
|
|||
|
|||
![]() Quote:
![]() I'm not dismissing the idea, but still have the hope of being able to do it on my new machine. Ed |
#5
|
||||
|
||||
![]()
Simply copying various Office 2007 files back to the PC with Office 2016 is not the same as having Office 2007 installed. You need to have Office 2007 installed if that's what you're developing for with early binding.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
||||
|
||||
![]()
You should not have to (or be able to) update the Office or Excel library references - they should adjust with the version of Office automatically.
|
#7
|
||||
|
||||
![]()
That has only ever been the case for references to libraries earlier than the one in use; it has never applied to references to libraries later than the one in use. Thus, a Word VBA project using references to the Excel 14.0 library will automatically work on systems with the Excel 15.0 library but will not do so on systems with only the Excel 12.0 library.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
||||
|
||||
![]()
I'm afraid that's not correct. If it were, you would have to late bind Excel code in Excel and remove the Excel reference, which is not possible. It is true that if you were writing code in Word, you'd have to update a reference to Excel, but code in Excel using references to Excel and Office (which are default references) does not require changing references, regardless of whether you are in an earlier or later version.
|
#9
|
||||
|
||||
![]()
While it is true that no library references need be added for code that's not doing any automation, they are needed for early binding with automation. Automation code compiled for newer libraries cannot be guaranteed to work with earlier ones. As advised by Microsoft (https://support.microsoft.com/en-us/...n-automation):
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
||||
|
||||
![]()
Yes, but that is not the case here, which is why I said there is no need to update any references.
|
#11
|
||||
|
||||
![]()
The OP's reply in post #3 to what I wrote in post #2 suggests otherwise.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
||||
|
||||
![]()
You may be right. Everything I've seen here suggests to me that the OP thinks he has a problem based on what he's read. Nowhere have I seen any mention of a specific actual problem. Either way, the Excel/Office references should not be an issue.
|
![]() |
Tags |
adding object library, vba excel |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
chamdan | Project | 2 | 04-21-2014 06:30 AM |
![]() |
tinfanide | Word VBA | 14 | 12-23-2011 02:43 PM |
![]() |
tinfanide | Excel Programming | 7 | 12-12-2011 05:21 AM |
Problem: object library invalid or contains references to object definitions | aligahk06 | Office | 0 | 08-19-2010 12:29 PM |
Access Object library 10 | Gyto | Office | 0 | 10-09-2008 09:04 AM |