0

I was working on a task in Word's VB Editor — that's Word 2016 for Mac — that needed associative arrays, and quickly found references to "Scripting.Dictionary", and then figured out that it comes from a library that is not installed with Office 2016 for Mac.

I found this question pointing to a third party library after a lengthy search. 2+ hours more searching, and I still can't figure out how to load it into Word. I found this reference to sandboxing, but it's talking about .dylib files and I've got a .cls — seems like a mismatch. There are oodles of references to loading libraries in Excel, but nothing I've found regarding Word has worked.

So, if I have a .cls file containing the source code for a library such as the one I've linked, how do I bring it into Word?

1 Answers1

0
  • Open the VB editor in Word
  • Right-click on the VBProject you're working on (or select it and choose Import file from the VB editor File menu)
  • Select Import File...
  • Browse to the cls file, select it and click the Open button
Tim Williams
  • 154,628
  • 8
  • 97
  • 125
  • Thanks for the reply, Tim. I've found instructions similar to these, but the problem is that there is no _Import file_ option on the contextual menu for the project, nor on the VB editor's _File_ menu. (I'm using Word for Mac v15.36.) The _File_ menu has only one item on it, _Close_, and the contextual menu has a different single item, _Insert_, with a submenu offering _Module_ or _Class module_. The latter creates a new module but doesn't allow for importing a file. There's an "Add References" button, but in its file browser the .cls files are greyed out. – RenaissanceBug Aug 16 '17 at 23:53
  • OK I didn't know that - VBA on Mac is kind of crappy vs. on Windows so I guess that's not surprising. However, you should be able to open up the cls file in any text editor and copy the content into an empty class module in the VB editor - it's just plain text. – Tim Williams Aug 17 '17 at 00:07
  • "VBA on Mac is kind of crappy vs. on Windows so I guess that's not surprising" — yeah, I'm getting that. :) Anyway, thanks for the suggestion; I tried the copy/paste thing, but the VB editor's rejecting large chunks of the syntax in the .cls file (meaning, red-highlighting it, and throwing syntax errors if I run it) — first all the VERSION and ATTRIBUTE lines, and then other stuff that looks like method declarations. (This, regardless of whether I put it in a "Module" or "Class Module" file.) **Correction**: some errors are compile errors ("Invalid outside procedure"). – RenaissanceBug Aug 17 '17 at 23:43