VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.76k stars 569 forks source link

getting compile error on 64-bit #11

Closed dineshgh closed 9 years ago

dineshgh commented 9 years ago

I am using this in MS-Outlook 2010 (newbie VBA), trying to execute the example test code. A whole lot of functions are highlighted and I am not sure what fix I need to apply. Will greatly appreciate help. Thanks.

image

timhall commented 9 years ago

@dineshgh thanks for bringing this up. Looks like the Win64 compiler directive needs to come first since Win32 applies to both 32- and 64-bit Windows versions so the 64-bit part is never reached. I'll fix this shortly.

dineshgh commented 9 years ago

@timhall awesome, thanks.

timhall commented 9 years ago

@dineshgh Do you mind giving the following a try to see if it resolves the compilation error? (I don't have a 64-bit version to test against at the moment)

https://raw.githubusercontent.com/VBA-tools/VBA-JSON/compile-error/JsonConverter.bas

dineshgh commented 9 years ago

Tim, Thanks. I imported the new JsonConverter.bas as a module, and then created a test function with the sample code. I get a different error now:

Error box: Compile error: User-defined type not defined

Highlighted Line: Private Function json_ParseObject(json_String As String, ByRef json_Index As Long, Optional json_ConvertLargeNumbersToString As Boolean = True) As Dictionary

I think I am missing type "Dictionary". Could I be missing some other type library?

Regards, Dinesh

On Sat, Feb 21, 2015 at 7:31 AM, Tim Hall notifications@github.com wrote:

@dineshgh https://github.com/dineshgh Do you mind giving the following a try to see if it resolves the compilation error? (I don't have a 64-bit version to test against at the moment)

https://raw.githubusercontent.com/VBA-tools/VBA-JSON/compile-error/JsonConverter.bas

— Reply to this email directly or view it on GitHub https://github.com/VBA-tools/VBA-JSON/issues/11#issuecomment-75376611.

timhall commented 9 years ago

Thanks for trying that for me, I think it would hit the 64-bit issues first so this should be fixed. To resolve the Dictionary issue, add the following to your workbook: https://raw.githubusercontent.com/VBA-tools/VBA-Dictionary/master/Dictionary.cls

dineshgh commented 9 years ago

Hi Tim, thanks for working with me. I don't really understand much of VBA :( this is my first foray.

(My project: is to analyze and display an email out of AWS Cloud Config emails. It's one big messy JSON blob.)

I imported the Dictionary class file, had to comment out the first 10 lines because of syntax errors (VERSION through Attribute lines). Also btw there is a typo in the test code for Dictionary (CompareMethod s should have been singular). Then I am trying to run the rest of the test code but keep hitting errors like "Object doesn't support this property or method". It could be because of the lines I commented out, maybe. So IOW I am still lost...

Regards Dinesh

[image: Inline image 1]

On Mon, Feb 23, 2015 at 7:37 AM, Tim Hall notifications@github.com wrote:

Thanks for trying that for me, I think it would hit the 64-bit issues first so this should be fixed. To resolve the Dictionary issue, add the following to your workbook: https://raw.githubusercontent.com/VBA-tools/VBA-Dictionary/master/Dictionary.cls

— Reply to this email directly or view it on GitHub https://github.com/VBA-tools/VBA-JSON/issues/11#issuecomment-75566351.

timhall commented 9 years ago

You can download the test file directly here: https://github.com/VBA-tools/VBA-JSON/blob/compile-error/specs/VBA-JSON%20-%20Specs.xlsm

Where do you see the typo in Dictionary?

Those errors are probably from not importing properly, which can be a little tricky. I would recommend saving the files to JsonConverter.bas and Dictionary.cls, respectively, and then importing to Excel rather than creating empty classes/modules in Excel and pasting in. The header lines are only interpreted properly if you import the file. (For now I'd use the test file given above)

dineshgh commented 9 years ago

Hi Tim, the typo is in the dictionary TEST file.

I will try what you suggested. I am using MS Outlook - should be similar to Excel VBA I hope.

Regards Dinesh

On Tue, Feb 24, 2015 at 8:44 AM, Tim Hall notifications@github.com wrote:

You can download the test file directly here: https://github.com/VBA-tools/VBA-JSON/blob/compile-error/specs/VBA-JSON%20-%20Specs.xlsm

Where do you see the typo in Dictionary?

Those errors are probably from not importing properly, which can be a little tricky. I would recommend saving the files to JsonConverter.bas and Dictionary.cls, respectively, and then importing to Excel rather than creating empty classes/modules in Excel and pasting in. The header lines are only interpreted properly if you import the file. (For now I'd use the test file given above)

— Reply to this email directly or view it on GitHub https://github.com/VBA-tools/VBA-JSON/issues/11#issuecomment-75793313.