Closed Thread
Results 1 to 47 of 47

UK Companies House API Code

  1. #1
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    UK Companies House API Code

    Hello

    I was reviewing the forum for a solution to my thought and came accross the thread 'UK Companies House API' a chap named Kyle123 developed a spreadsheet which linked up to companies house via a spreadsheet and pulled particular information.

    I am learning on excel and trying to learn code.

    I am unfortunately too much of a novice to understand the code on the spreadsheet.

    What i am trying to achieve is a link to Companies house via an API which would pull the following data from Companies house based up a the 'company registration number'
    I would like to see the following results 'Next Accounts', 'Next Accounts Due By', 'Confirmation Due by', Registered Office'

    Here is an example of the spreadsheet i would like to show:

    Company Name Company Number Next Accounts Next Accounts Due By Confirmation Statement Due By Registered Office Addres
    A Limited 1234567 (Date) (Date) (Date)
    B Limited 1234567 (Date) (Date) (Date)
    C Limited 1234567 (Date) (Date) (Date)
    D Limited 1234567 (Date) (Date) (Date)


    Thank you

    Marc

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

    Re: UK Companies House API Code

    Please upload a workbook, not copy and paste into the thread, it makes it easier to help you since no-one has to re-create your workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Please also include some actual company registration numbers so someone doesn't have to go searching for some to help.

    Finally, my mentioned thread is here if anyone is looking to help: http://www.excelforum.com/tips-and-t...house-api.html

  3. #3
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Hi Kyle

    Thank you for your reply

    I have attached a spreadsheet, i hope its not too rubbish.

    I have 3 sheets, first 1 is what it would look like before the code initialized, i would like to drop the the information into the spreadsheet on the second sheet.

    Then 3rd sheet is the results, but its would be for more multiple such as 300 or more.

    The purpose is to be able to look up data to Companies House website on a mass basis and identify deadlines and any discrepancies.

    Thanks

    Marc
    Attached Files Attached Files

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

    Re: UK Companies House API Code

    Hi Kyle,
    I have not be able to test your work, as I still have got problem with this bloody error 429. I know there are lots of things missing from my registrar. Active X component is one of them. I do not want to miss up my pc by manually editing the window registrar. MS has asked me to fork out $500 dollar to fix this issue. I am really very frustrated with this error, as I am unable to create an object, even using late binding. I have spent over the last 6 months searching for on-line solution, but not luck yet.
    By the way, could your code download the pdf accounts from companies house?
    Last edited by AB33; 09-26-2016 at 12:26 PM.

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

    Re: UK Companies House API Code

    Hi Kyle,
    I have not be able to test your work, as I still have got problem with this bloody error 429. I know there are lots of things missing from my registrar. Active X component is one of them. I do not want to miss up my pc by manually editing the window registrar. MS has asked me to fork out $500 dollar to fix this issue. I am really very frustrated with this error, as I am unable to create an object, even using late binding. I have spent over the last 6 months searching for on-line solution, but not luck yet.
    By the way, could your code download the pdf accounts from companies house?
    Last edited by AB33; 09-26-2016 at 12:26 PM.

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

    Re: UK Companies House API Code

    @op I'll hAve a look at this in the morning for you

    @ab33 can't you just stick the Windows disk in and reboot? I tend to do that about every 6 months or so. My code doesn't do that now but it would be pretty easy to add that if needed, I only mapped the data I needed at the time

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

    Re: UK Companies House API Code

    Hi Kyle,
    I had the same issue with windows 7. My other windows XP PC still shows the same error. In fact, I had re-installed windows 7 before I upgraded to windows 10. Trust me, it might be easier to fix this error for some one like you who is computer savvy. I have no idea what is mapping.
    This is very common error and the help from MS is the same crap-install and re-install MS office. After lots of search, I have pinned down the error to missing some thing from the registrar.
    This website has good info.
    http://mkksharepoint.blogspot.co.uk/...component.html
    but can take the chance to destroy my PC.

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

    Re: UK Companies House API Code

    @AB33 I'd do it and wipe my machine if it's a problem. Re-installing windows is pretty trivial, especially with win 10, I can do a clean build and have all my applications installed and updated in under a day (most of it is just clicking next).
    @Marc, you want something like the attached. I've also included the pertinent code below:
    Please Login or Register  to view this content.
    You will obviously need to get your own API key (and insert it into the CONSTANTS module). In addition, the rate is throttled, so expect this to stop working if you run > 600 queries every five minutes.
    Attached Files Attached Files

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

    Re: UK Companies House API Code

    Hi Kyle,
    I thought wipe out is over kill. I do not know how I re-install all applications. I am also not sure if these steps could be the remedy for the issue I am having. I had the same problem with Windows 7. So, I would have expected windows 10 to add any missing from registrar, but did not.
    Last edited by AB33; 09-28-2016 at 04:48 AM.

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

    Re: UK Companies House API Code

    I wipe every six months does wonders for performance

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

    Re: UK Companies House API Code

    Hi Kyle,
    Do you use some of kind of software to re-install your applications, or is it something built-in windows 10?

  12. #12
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Hi Kyle

    Thank you.

    I have inputted my API key.

    What is my next step how do i run the code once i have inputted my population.

    Thanks

    Marc

  13. #13
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Hi Kyle

    Thank you.

    I have inputted my API key.

    What is my next step how do i run the code once i have inputted my population.

    Thanks

    Marc

  14. #14
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: UK Companies House API Code

    Intresting query AB33!
    Please consider:
    Be polite. Thank those who have helped you.
    Click the star icon in the lower left part of the contributor's post and add Reputation. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Posting code between tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

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

    Re: UK Companies House API Code

    Hi IonutC,
    Well, unless there is some sort of auto mechanism to retrieve the back-up data and all applications, why would any one will reboot their PC every 6 months? Imagine the amount of time takes to install your previous applications.

  16. #16
    Forum Contributor IonutC's Avatar
    Join Date
    01-28-2016
    Location
    Bucharest, Romania
    MS-Off Ver
    Office 2019
    Posts
    486

    Re: UK Companies House API Code

    Yeah! There are some companies where the image of each computer is saved on a server and if your notebook cracked or is destroyed you can retrieve all your data....

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

    Re: UK Companies House API Code

    @AB33 & IonutC, I've answered here so we don't keep hijacking

    http://www.excelforum.com/the-water-...ix-months.html

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

    Re: UK Companies House API Code

    @Marc

    I've attached with a button on the worksheet to make it easier
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Thank you

    When i chick the button, i am getting a error message 'run-time error 110021: Syntax Error

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

    Re: UK Companies House API Code

    Have you put your API key in?

    Note that you'll also need the Company numbers as strings, the leading zeros are required.
    Last edited by Kyle123; 09-28-2016 at 08:27 AM.

  21. #21
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Thank you Kyle, i am such a divy haha

    it works great, however, i have listed 280 clients and i get the following error after line 79 "Object variable or with block variable not set"

    Also, majority of the Year End Accounts Date is only bringing through 01/01/1990 instead of the date

    Thanks

    Marc

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

    Re: UK Companies House API Code

    Could you post a workbook with the offending company numbers in?

  23. #23
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Sorry but i wont be able to because of data protection.

    Everything pulls through apart from the majority of the Year End Dates

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

    Re: UK Companies House API Code

    Why data protection? It's public information. I can't help you if you can't give me an example

  25. #25
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    here is an example of the clients
    2015 Solutions Ltd 09955615
    4gk Consultants Ltd 09928394
    AG1 Consultancy Limited 10055196

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

    Re: UK Companies House API Code

    It's because they don't have any last accounts posted - well they're not accessible on CH anyway

    To stop the error, replace the part of the code in the module with this:
    Please Login or Register  to view this content.
    (Notice the On Error Resume Next)
    Last edited by Kyle123; 09-28-2016 at 10:28 AM.

  27. #27
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    ok i understand now, is there a way to but in the code if it is the first year then put 'first accounts made up to'

    you have been great by the way

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

    Re: UK Companies House API Code

    Sure, try this:
    Please Login or Register  to view this content.
    Actually, the above just checks if there are any last accounts, if not then it puts 'First accounts made up to', would you rather check the date of creation?
    Last edited by Kyle123; 09-28-2016 at 10:33 AM. Reason: Mistake in code

  29. #29
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Is there a way to pull the actual date of the first accounts date, i have inputted the code and its the wording that comes up

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

    Re: UK Companies House API Code

    Which is the first accounts date in the below:
    Please Login or Register  to view this content.

  31. #31
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    },
    "accounts": {
    "next_made_up_to": "2016-04-05",

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

    Re: UK Companies House API Code

    do you want that instead of the last accounts made up to?

  33. #33
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Yes please, i can add in the code

  34. #34
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    i mean if you can post it on here plz

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

    Re: UK Companies House API Code

    Please Login or Register  to view this content.

  36. #36
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    this is fantastic, thank you.

    i was wondering whether you could us an API code to push information to an accountancy book keeping cloud based software?

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

    Re: UK Companies House API Code

    Yes, if the accountancy cloud software has a published api that allows it.

  38. #38
    Registered User
    Join Date
    09-22-2016
    Location
    England
    MS-Off Ver
    2010
    Posts
    28

    Re: UK Companies House API Code

    Hi Kyle

    Yes it does allow it, it has a separate API per client.

    Can you help me in adding an additional column on the spreadsheet for pulling the company registered number

    Thanks

    marc

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

    Re: UK Companies House API Code

    This is my poor guess until Kyle pops in

    cll.Offset(0, 6).Value = company.Company_number

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

    Re: UK Companies House API Code

    Hi, sorry, been on holiday.
    Can you help me in adding an additional column on the spreadsheet for pulling the company registered number
    All the code above assumes that you already have the registration number. If you don't the process is much more involved. It's quite likely that searching by business name will return multiple results, how would you want to see this? How would you determine the correct one? You're starting to get into userform territory. In fact, my original example in the other thread shows you how to search by company name and return the associated information.

  41. #41
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: UK Companies House API Code

    Hi guys. I have stumbled across this read, which could be pretty useful for my line of work.

    With regards to an API for this module to work, where would one be obtained from?

    Many thanks.

  42. #42
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: UK Companies House API Code

    Hi guys. I have stumbled across this read, which could be pretty useful for my line of work.

    With regards to an API for this module to work, where would one be obtained from?

    Many thanks.

  43. #43
    Forum Contributor
    Join Date
    03-04-2014
    Location
    Birmingham, England
    MS-Off Ver
    Excel 2019
    Posts
    756

    Re: UK Companies House API Code

    This is not working for me. I have got an API key from CH and put that in the CONSTANTS module.

    I am then running the macro via the button which Kyle added in.

    I am then inputting a company name and number and pressing get data and get this error:

    Run-time error '-2147012867 (80072efd)':

    A connection with the server could not be established


    When I choose 'Debug' I get this code highlighted:

    Please Login or Register  to view this content.
    Any help please?

  44. #44
    Forum Contributor
    Join Date
    06-07-2013
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    158

    Re: UK Companies House API Code

    Hi guys/girls

    I found this post which seems really helpful and close to what I'm after.

    Does anyone know how to add additional fields from Companies House through the API? I have spent a bit of time trying to add a few extra fields with no luck.

    I'm after the Transaction_ID from the filing history. I'm after the latest full annual accounts which have been published.

    thanks in advance

  45. #45
    Registered User
    Join Date
    12-16-2021
    Location
    ESSEX
    MS-Off Ver
    365
    Posts
    2

    Re: UK Companies House API Code

    Hello,

    i am struggling with it any just want to know how do you input the api key.
    Please help.

  46. #46
    Registered User
    Join Date
    12-16-2021
    Location
    ESSEX
    MS-Off Ver
    365
    Posts
    2

    Re: UK Companies House API Code

    Hello,

    I am struggling with it any just want to know how do you input the API key.
    If you have any new version of file running smoothly.
    Please help.
    Regards.

  47. #47
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: UK Companies House API Code

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed 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
    By Kyle123 in forum Tips and Tutorials
    Replies: 38
    Last Post: 03-24-2020, 11:08 AM
  2. House Numbers
    By kumarin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2015, 09:16 AM
  3. New in the house!
    By Machme in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 03-14-2015, 08:21 AM
  4. VA in the house!
    By shingik in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 08-27-2013, 07:31 PM
  5. Replies: 14
    Last Post: 07-28-2013, 10:44 AM
  6. The Dog House!
    By Mordred in forum The Water Cooler
    Replies: 10
    Last Post: 06-30-2011, 06:19 PM
  7. New MVP in da house?
    By Domski in forum The Water Cooler
    Replies: 21
    Last Post: 08-20-2010, 01:21 PM

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