PerditionC / VBAChromeDevProtocol

VBA (Excel) based wrapper for Chrome Developer Protocol (CDP) - sorta a VBA version of Puppeteer/Selenium
https://PerditionC.github.io/VBAChromeDevProtocol/
MIT License
61 stars 13 forks source link

Class modules incorrectly importing as Modules due to line ending issue #1

Closed deeeeekun closed 2 years ago

deeeeekun commented 2 years ago

I tried importing all the files to my Microsoft Outlook project, but all the class modules got imported as regular modules.

I am using the following environment:

Currently, I am inserting new Class modules and copy-and-pasting the contents. But there are a lot of files 😭

Any help would be appreciated.

PerditionC commented 2 years ago

You should import or drag-n-drop the files. But if you really want to copy-n-paste, make sure you are inserting a class module; the module type is determined in this case is determined by what you choose to insert - VBA project will not automatically change a class module into a regular module or vice-versa. Note that although it appears to work (and there is no reason it should not), the VBA code is only tested under Excel. When using Outlook, you will need to enable macros or digitally sign your macros or they will not function correctly when initially adding and be disabled when restarting Outlook. Also, after importing (again I recommend drag and drop from an Explorer window as it will do the correct action), be sure to add a reference to Microsoft.ScriptingRuntime dll to enable the Dictionary object. Also note that not all the files need to be imported, but yes it is a lot of files, which is why copying from explorer helps as you can select multiple files to drag and drop instead of one at a time as done by manual importing or even harder by inserting a [class] module and then copy and pasting the contents.

deeeeekun commented 2 years ago

Yes, I dragged and dropped from an Explorer window but they were all imported as modules instead of class modules. Maybe a VBA bug.

PerditionC commented 2 years ago

Sorry I misread, I see what is happening now. You drag and drop and the file gets put in the wrong module type so you were manually creating the class module and copying the contents. Definitely don't want to have to do that for all these classes. It is a VBA issue sorta, the files are most likely not being converted back to CR LF and just have LF which confuses Office apparently. I will look how to ensure git keeps the CRLF but still treats the file as text and not undiffable binary. In the short term, I have added to the last release a zip https://github.com/PerditionC/VBAChromeDevProtocol/releases/download/v0.3/VBAChromeDevProtocol-source.zip with the files that should work for drag and drop. Please try them and let me know. Another alternative is to run unix2dos on the files you have or simply open in Wordpad and save.

deeeeekun commented 2 years ago

I have tried and confirmed that I can now import the Class modules properly. Now I can play around with them! Thank you very much!