hilkoc / vbaDeveloper

Tools for development and version control of vba code
MIT License
510 stars 138 forks source link

problem installing (Excel 2010) #1

Open mkaut opened 9 years ago

mkaut commented 9 years ago

I have tried to follow the installation instructions (twice), but when I come to step 9 (running testImport), the routine eventually crashes with error message "Compile error: Expected: end of statement", pointing to the first line of "Custom Actions". It looks like Excel is trying to interpret CustomActions as a VBA module and therefore does not understand the first line, "VERSION 1.0 CLASS"..

Boggin commented 9 years ago

I have a similar problem with Excel 2010 (Pro Plus). Nothing happens at all when I try to run testImport().

MCallas commented 9 years ago

Same error as mkaut. I'm using Excel 2010. The .cls modules are importing into the regular Modules container instead of the Class Modules container and the ThisWorkbook.sheet.cls doesn't import at all. The Private WithEvents App As Application line in the EventListener.cls also fails because the .cls modules are in Modules and not Class Modules. It does no good to move them manually because the import feature deletes and re-imports the objects into the one Modules container.

mcgr0g commented 9 years ago

Hello guys! I have the same bug. But you can fix it by your self:

  1. ThisWorkbook.sheet is not module, a class or worksheet. It's record of workbook instance and you have to copy-paste it to local workbook instance look screenshot
  2. All other cls file are imported incorrectly in vbe. I suppose it's MS bug. You can this
    • create Class1
    • export Class1
    • copy paste anyone cls into Class1
    • rename this file to string Attribute VB_Name
    • import it

And it'll be imported correctly. This is mine example https://github.com/mcgr0g/vbaDeveloper/releases/tag/v1.0 Good luck!

hilkoc commented 9 years ago

This issue is also present in excel 97. The problem is on this line: vbaProject.VBComponents.Import filePath

For some reason it does not work as it should. Maybe there is some setting or configuration that needs to be enabled? Any tips or ideas for a workaround are welcome.

gberl001 commented 9 years ago

I can't seem to find anything that would cause this that we might have direct control over. An ugly but functional work around would be to add a class object and then transfer the code using fso.... but I'm not sure if anyone is ambitious enough to do it, I would but I have no time.

Here is a link for someone who has done it in their Maven implementation. They actually specifically state that the class modules must be done this way so maybe this is the only way. http://stackoverflow.com/questions/704759/source-control-of-excel-vba-code-modules