+ Reply to Thread
Results 1 to 17 of 17

Companies House Officer data

  1. #1
    Registered User
    Join Date
    03-12-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    19

    Companies House Officer data

    Hey guys,

    New here (hoping to be very active as time goes on!) but hope you don't mind my first post being a request for assistance or guidance.

    I found a very useful file, created by Kyle123 and have adapted it to my needs (somewhat) in one respect. However I am now trying to use it to find Officer data, but keep running in to problems.

    The error I keep getting is 'Compile error: Method or data member not found'.

    Does anybody have any idea what could be causing this error? I have attached the file for reference (though have removed my Companies House API) with the code that isn't working in Module Two.

    Any help will be greatly appreciated.

    Thank you and kind regards,

    Ben
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,385

    Re: Companies House Officer data

    Stepping through the macro code reveals the following:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-12-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    19

    Re: Companies House Officer data

    Hi Logit, thank you for your reply.

    Any particular reason that the API is highlighted? I have a working API key in the workbook on my machine and it works absolutely fine with the filing data, however I just cannot get the officer data to work - presumably because of the 'Object variable...' errors that you have pointed out above.

    Do you have any idea why this is happening? It could well be that the 'officer.' is the wrong prefix, however I have tried multiple solutions but to no avail.

    Thank you again,

    Ben

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Companies House Officer data

    Hi Ben,
    Your adjusted code is not right. You are trying to pick values from

    'Officers
    Set m_objofficer_summary = New CHOfficerSummary
    This class does not have the properties(values) you are looking for-name, appointed_on and officer_role
    These values are found on class CHOfficer. You need to add this class in to CH Company class in order to grape the values in that class.
    I am unable to find my API to test it. Kyle is the right person to help you with adjusting the code if you struggle. I am sure as soon as he sees it, he will butt in to help you.
    Last edited by AB33; 03-13-2017 at 06:24 AM.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    Thanks AB33, you're right, however it may not help you Ben. The officers collection has what you're after, but there can be more than one officer which wouldn't fit your structure (presumably), so you could return only the first officer, or loop through them all and save their details elsewhere:

    First officer (index may be one based, not zero, I can't remember without looking):
    Please Login or Register  to view this content.
    All officers:
    Please Login or Register  to view this content.
    @Logit, what are you doing to get a syntax error?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Companies House Officer data

    Hi Kyle,
    I am learning OOP and your code is what I needed in order to "Orient" my set of mind. It has got all the OOP's ingredients- except inheritance and polymorphism- which are not supported by VBA.
    Though not fully, I understand your code. I have a single question to ask you if you do not mind. All the properties you are using probably match or tag with the underlying JS script you are trying to pick up from. Where and how do I find these values in the site page?
    Last edited by AB33; 03-13-2017 at 07:05 AM.

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    They're not in the site page, they're from the API documentation - https://developer.companieshouse.gov...-resource.html

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Companies House Officer data

    Hi Kyle,
    Thanks mate!

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    As it would happen, I actually have a version of this with inheritance (interface inheritance anyway) as I had slightly different implementations for 64 bit Excel (as it stands the workbook doesn't work in 64-bit) - I've now mostly resolved these to make the code compatible with 64 and 32 bit.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Companies House Officer data

    Hi Kyle,
    Would you make it public at some point?

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    Here's a version with the interface implementation, it's probably non working (might if you're luck though!), but feel free to pick through it.

    You'll need an API key (they're free) and put it in the constants module.

    This is a somewhat more involved version of the initial spreadsheet as it deals with the rate throttling - it includes a timeout.

    The workbook allows searching of companies, lets you select the one you want and then populates the additional information
    Attached Files Attached Files

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    It has a different implementation of the JSON parsing, one for 32 bit and one for 64 bit, both CompaniesHouseResponseParser32 and CompaniesHouseResponseParser64 both inherit the ICHJSONParser interface

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Companies House Officer data

    Hi Kyle,
    Thanks again!
    I will play with it and see how far I can go.

  14. #14
    Registered User
    Join Date
    03-12-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    19

    Re: Companies House Officer data

    Hi Kyle and AB33,

    Thank you for your replies

    I cannot get either of the above samples of code to work - I keep getting errors with both of them.

    For the first sample, I get "Run-time error 9 - Subscript out of range" and it highlights the following line: "cll.Offset(0, 2).Value = company.officers(0).name".

    For the second sample, I get "Run-time error 13 - Type mismatch" and it highlights the following line: "For Each officer In company.officers".

    Point taken re structure, I would look to amend the form to mimic the attached - I want to be able to choose a company and have all officers listed.

    Your help is greatly appreciated.

    Ben
    Attached Files Attached Files
    Last edited by excelerators; 03-13-2017 at 01:13 PM.

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Companies House Officer data

    You want:
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    03-12-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    19

    Re: Companies House Officer data

    Kyle,

    I think I love you.

    Cheers mate!

  17. #17
    Registered User
    Join Date
    03-12-2017
    Location
    United Kingdom
    MS-Off Ver
    2016
    Posts
    19

    Re: Companies House Officer data

    Out of interest Kyle, have you tested your API work with fetching the filings at Companies House? For example, using the template that I uploaded for the 'Officers' layout, would it be possible to have your worksheet list all filings within the last, say, 24 months, with links directly to that document? Interested to see the capabilities of what you've created - it's awesome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. UK Companies House API Code
    By 19marc87 in forum Excel Programming / VBA / Macros
    Replies: 46
    Last Post: 12-17-2021, 07:53 AM
  2. UK Companies House API
    By Kyle123 in forum Tips and Tutorials
    Replies: 38
    Last Post: 03-24-2020, 11:08 AM
  3. Companies House API - search for companies, populate spreadsheet.
    By damnation in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2016, 10:52 AM
  4. Military Officer looking to make the Army more efficient
    By seancalleja in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 03-06-2015, 06:58 AM
  5. New QC Officer
    By CCAgent101 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-15-2014, 03:14 AM
  6. Information Officer
    By Kelechi in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 05-01-2014, 12:43 AM
  7. Replies: 14
    Last Post: 07-28-2013, 10:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1