VBA-tools / VBA-Dictionary

Drop-in replacement for Scripting.Dictionary on Mac
MIT License
348 stars 89 forks source link

Installation instructions #5

Closed jcushman closed 9 years ago

jcushman commented 9 years ago

I'm having a little trouble installing this in a fresh document. Here's what I tried:

(1) In Excel 2011 for Mac, if I right-click on "Class Modules", choose "Import File ...", and select Dictionary.cls, I get this error:

"The form class contained in '[my path]:Dictionary.cls' is not supported in VBA. The file can't be loaded."

(2) If I create a new Class Module, name it Dictionary, and paste the contents of Dictionary.cls in, then the class sort of works, but assignment is broken:

Dim test As New Dictionary
' this works:
test.Add "Bar", "Baz"
' this doesn't work:
test("Key") = "Foo"
'=> Run-time error '438': Object doesn't support this property or method

(3) If I open an existing project that already has this installed (like VBA-Web - blank.xslm), the code above does work. So I know that Excel 2011 is compatible -- I must just be doing something wrong during the install.

Many thanks -- VBA-tools looks like some great work, and super helpful if I can just get it working. :)

Thanks, Jack

timhall commented 9 years ago

Hi @jcushman I had some similar problems in the past, but not this one in particular. I'll look into this further.

timhall commented 9 years ago

This turns out to be a line-ending issue. It appears Excel Mac requires Windows line-endings (CRLF) when importing modules and classes and saving Raw content from GitHub uses just a LF, causing this issue.

Solution: Download the full source code zip, https://github.com/VBA-tools/VBA-Dictionary/releases. I've set up the repo to always include CRLF for files, so cloning the repo or downloading the full source avoids these issues.