VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.02k stars 494 forks source link

Importing Class incorrectly imports as Module and fails #24

Closed timhall closed 10 years ago

timhall commented 10 years ago

Originally reported with issue #22, seems that importing classes in Excel 2010/2013 64-bit is improperly treating them as modules and leaving behind header information that causes errors.

timhall commented 10 years ago

@dsrlb I was able to find a copy of Excel 2010 x64 and when I imported the files they were successfully added as Classes instead of Modules. Here was how I imported the files:

From VBA (Alt+F11):

I'm closing this issue, but feel free to post an update if you're still getting the problem

przemoli commented 10 years ago

Hi!

I still can not get Excel to import it correctly. (Excel 2013 SP1 64bit)

EDIT: I have workaround: Importing all the files. Creating class modules. Copying code from .cls files into those modules without headers.

After that VBA Project Compile returns no bugs.

timhall commented 10 years ago

@przemoli Would you be able to record a screencast of the steps that you are using to import the files and what is occurring? (http://www.screencast-o-matic.com/ seems helpful for recording screencasts) You can email me directly with the screencast (my email is in the source). This is an important issue to me and would like to have an official fix to avoid a workaround.

timhall commented 10 years ago

To anyone following this, @przemoli sent me a screencast and there is indeed some strange import behavior happening that I'm trying to nail down now.

timhall commented 10 years ago

Ok, there have been a few more reported incidents of this and it does not appear to be limited to 64-bit Excel. The issue appears to be line endings. When extracted from the downloaded zip file, the line endings are UNIX-style (LF or \n) and from my local files they are Windows-style (CR + LF or \r\n). After switching the downloaded file with Windows-style line endings the file imported correctly as a Class. I'll look into how this can be resolved.

timhall commented 10 years ago

Note: using install.bat imports classes correctly

timhall commented 10 years ago

I've updated the git config to use Windows-style line endings for modules and classes and from what I can tell it fixes the issue.