Link to home
Start Free TrialLog in
Avatar of ThomasMcA2
ThomasMcA2

asked on

VBA - How do I develop macros in Excel 2013 for Excel 2010 clients

I already know the solution, I just don't know how to implement it.

I can find tons of hits on Google about late binding: just declare my variables as Objects, and then use GetObject or CreateObject.

That's easy to do for Excel objects from within Word. But how do I do that for Excel objects from within Excel? The VBE won't let you uncheck the Excel library from within Excel, even in a brand-new, empty workbook!

User generated image
NOTE: this is happening to me from Excel 2013.
SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ThomasMcA2
ThomasMcA2

ASKER

Thanks, but that is an illogical approach for MS to take, which is why I never expected that to be the answer.

If the IDE can access Word or PowerPoint methods and properties via objects, then it should do the same for Excel.

By forcing Excel to be referenced, it is allowing the current application to use early binding, but everything else has to use late binding. But if you do use that early binding, then your code will fail on desktops that have an earlier version of Excel. That seems error-prone to me.

I will wait to see if the older version of Excel generates an error before I accept your answer.
>>Thanks, but that is an illogical approach for MS to take, which is why I never expected that to be the answer.
I tested in Macro environment for Word and Outlook, they didn't allow me to remove the respective Object Library as well. So, this could be the way how macro was built.

This article further explained this behavior was "by design".

OFF: Error When You Remove Forms Object Library Reference
https://support.microsoft.com/en-us/kb/155207
Why would you want to remove the parent library reference?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks. I still need to test whether my code works on the lower-versioned desktop.
I've requested that this question be closed as follows:

Accepted answer: 500 points for ryancys's comment #a40901410

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Thanks for closing the question, ThomasMcA2.

Good luck with the rest of your project.