cristianbuse / VBA-FastDictionary

Fast Native Dictionary for VBA compatible with Windows and Mac
MIT License
26 stars 3 forks source link

Test error #4

Closed cecilesavoie closed 4 months ago

cecilesavoie commented 4 months ago

at

Private Function GetDefaultInterface(ByVal obj As stdole.IUnknown) As Object

Excel on Mac Sonoma

cristianbuse commented 4 months ago

Hi @cecilesavoie ,

I think you need to add the Ole Automaation reference. Same issue was raised in #3 Please let me know if that works

cecilesavoie commented 4 months ago

Yes! I had it checked before but somehow it was unclicked again. Once clicked the test worked. Thank you for your prompt answer and apologies for asking the same question: I am not very familiar with Github and was looking for other comments but did not manage to figure out where they were.

cristianbuse commented 4 months ago

Thanks for the feedback @cecilesavoie

Don't worry about asking the same question. Took me only 10 seconds to respond.

Normally, the OLE Automation is on by default so I did not consider this a dependency when creating this class. However, I might look into removing this entirely as it seems to be causing trouble.

IUnknown is being used in 3 places only, out of which one in testing, as you pointed out the GetDefaultInterface method.

I already know that I can replace one of the 3 with Variant (for NewEnum) but I did not find another way to get the base interface without casting to IUnknown. If I do, then I will remove this dependency entirely.

Any feedback is welcome. Thanks!

cecilesavoie commented 4 months ago

I think a note should be just fine. This little adventure of mine resemble the nursery rhyme "There's a hole in the bucket". I first was trying to do some Excel VBA stuff and found a video where the method I need is being taught. However he turned on the scripting.runtime... and then I was down the rabit hole figuring this one out LOL. During my research I found out that 4 libraries should be turned on by default, and you are right, among them the ole. A fifth one is recommanded to turn on (Microsoft Forms). However, in fact, what was turned on by default was the form and not the ole one. HTH.

cristianbuse commented 4 months ago

Will add a note if I cannot remove the dependency. As a note, the Microsoft Forms reference gets added automatically if one inserts a form so it is rarely needed to be added manually.

cristianbuse commented 4 months ago

Thanks again @cecilesavoie

I added a note after all to the Installation section of the main ReadMe file.

In case you are curious about why it is difficult to remove this dependency, see this discussion.