![solidworks api vba parse directory solidworks api vba parse directory](https://i.ytimg.com/vi/3GC4nwdmCMY/maxresdefault.jpg)
Then add reference to that module and call it from both your Macro1 and Macro2 sub routines. You could create a separate module to encapsulate your common methods. I'll give details of the errors I get if asked for them. Things I`ve tried:, , VBA module that runs other modules, Call a Subroutine from a different Module in VBAĪll of them are problematic. How do I call the second from the first, passing in the data from the first, and using it in the second? These macros are of course saved in different files. Macro 2 does something that requires data from macro 1: Dim swApp As Objectīoolstatus = 2("Front Plane", "PLANE", 0, 0, 0, True, 0, Nothing, 0) 'end of added code, don't know what to add. 'added code: here I want to call the second macro and send it distance_of_second_plane, and have it use that value However, users can choose to treat individual files as a special case, allowing the default analysis procedure you to be overwritten for that file.Dim longstatus As Long, longwarnings As Long In the vast majority of cases, the file analysis will work with no user intervention required. This application has been designed to make importing and handling JSON files a straightforward and, in many cases, a largely automated task.Ī) Fully automated analysis of JSON files including handling of subarraysī) Fully automated creation of tables and transform functions based on file analysis.Ĭ) Import JSON data into normalised Access tables based on file analysisĭ) Over 90 sample JSON files are supplied as examples I have created an application called JSON Analyse and Transform for Access (JATFA) which is available via my website. NZ() takes any value and tests it for null, converting it to a number or string if the value is null – google can help)
#SOLIDWORKS API VBA PARSE DIRECTORY CODE#
If you’re trying to use this code in excel, you’ll need another way to handle nulls. (NOTE: NZ() in Excel – the NZ() function is an Access function and not available in excel.
#SOLIDWORKS API VBA PARSE DIRECTORY HOW TO#
If you’re interested in some more information on how to consume web services with VBA, check out the Web Work with VBA blog post. In any case – while Tim Hall’s interface is a bit more friendly to use and works in most cases, this one works in all cases. Thus, we ought to ensure we’re working with a trusted source if we’re going to be using it (but this holds true for just about any external source, I think). That function basically says “take any string and execute it as if it were JavaScript”, which has some significant security implications. One important thing to bear in mind is that this method does make use of JavaScript’s Eval() function. If only JSON has an equivalent query language like XPath for XML!
![solidworks api vba parse directory solidworks api vba parse directory](https://developers.exlibrisgroup.com/wp-content/uploads/2018/11/Create-PO-line-API-how-the-bibliographic-record-is-determined-screenshot-1.png)
Essentially loop through the keys and determine if it’s a Property or Object, and recurse as required.
![solidworks api vba parse directory solidworks api vba parse directory](https://thecadcoder.com/assets/vba-images/Open_assembly_and_drawing_from_Userform/condition-that-control-opening-document.png)
This effectively parses the values (for any valid JSON – I tested loads of it and gave a presentation at the annual PAUG conference last year without an egg on my face), but working with the values when you’re done is a bit of a headache. Following that is another code example for how to use this.Īdmittedly, it could be easier to use.
![solidworks api vba parse directory solidworks api vba parse directory](https://www.codestack.net/solidworks-api/document/features-manager/run-command-sync/command_open.png)
Toss the following into a standalone module. (credit to StackOverflow member Codo for the original source, as near as I can tell) As well it should, is it’s tapping into the Microsoft JavaScript Engine to do the work. In any case, after numerous hours and at least a dozen different parsers being tested, I found the one that seems to work across the board. Furthermore, there’s a number of other “hand-made” parsers that seem to suffer the same faulty algorithm. The issue seems to be in the parsing algorithm used: some structures of valid JSON raise errors using the above code (see some examples here – and maybe watch the issue to see if there’s a fix at some point?). I used this for a while myself, until I ran into a case that it fails on, which put me back on the drawing board. Tim Hall has a great set of tools in his github repo, one in specific called VBA-JSON that tends to be a first hit when people have to go searching. We work with JSON a fair amount (and honestly I can’t say I care for it too much for anything outside of the JavaScript realm), and when it comes to VBA, there’s next to no support for it.