3

I have downloaded some code modules (.cls files) from a Git Repository. When I import (some, not all) into the VBE (File: Import), it imports it as a 'Standard' module (as if it were a .bas file).

If I open the cls file in Notepad++, copy the entire contents to a new file and save as "a.cls" then I can import and it correctly is interpreted as a new Class.

I am totally confused and with lots of code modules to go through, I don't want to have to manually re-save each one.

Does anyone have any ideas?


EDIT

I am importing in to Excel 2016 (64-bit) on Windows 10. I don't know the Excel version that the files were created in.

The files are at: https://github.com/ckuhn203/VBEX/tree/master/src

As an example: Monadic.cls imports as a standard module file.

PeterB
  • 107
  • 8
  • Probably worth mentioning the question the version of the application you are importing to and the version of the application that the class files were generated from? – Robin Mackenzie Aug 12 '16 at 11:51
  • Is the link to the .cls file public? If not, can you edit the question to include the header (everything through the last `Attribute`? – Comintern Aug 12 '16 at 12:26

1 Answers1

5

This is because the files have a single LF for the line break.

MS Office expects code files to use CRLF. Because it doesn't find it, it fails to read the attributes that declare the file is a class.

See e.g. Windows command to convert Unix line endings? to mass-replace the line breaks.

Community
  • 1
  • 1
GSerg
  • 76,472
  • 17
  • 159
  • 346