+ Reply to Thread
Results 1 to 29 of 29

Screen Freezes When Calling HTTP Requests

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Screen Freezes When Calling HTTP Requests

    Hi,

    I have a pretty complex excel that generates data based using a few HTTP Requests.

    The Excel works as needed and there is no problem with getting the output.

    However, when the requests are being processed (Which takes around 15 seconds) the screen freezes and I only see this.

    I have tried setting the Screen Updating to False, Do events etc. but nothing would work.

    Any tips would help me out greatly.

    Cheers!
    Deep Dave
    Attached Images Attached Images
    Cheers!
    Deep Dave

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

    Re: Screen Freezes When Calling HTTP Requests

    I suspect that you need to do the call asynchronously

    We need to see your code

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi,

    Here is the code. I have changed the names a bit to hide sensitive data.

    It wont let me paste the code for some reason. Hence the screenshot
    Attached Images Attached Images
    Last edited by NeedForExcel; 04-12-2018 at 08:12 AM.

  4. #4
    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
    79,365

    Re: Screen Freezes When Calling HTTP Requests

    Screenshots are useless. Copy and paste the code into your next post and put code tags (# on the toolbar) round it.
    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.

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Quote Originally Posted by AliGW View Post
    Screenshots are useless. Copy and paste the code into your next post and put code tags (# on the toolbar) round it.
    Hi,

    I tried it, but I am getting this error
    Attached Images Attached Images

  6. #6
    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
    79,365

    Re: Screen Freezes When Calling HTTP Requests

    Does the code contain any HTML?

  7. #7
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Quote Originally Posted by AliGW View Post
    Does the code contain any HTML?
    The Code Screenshot attached in Post #3 is precisely the code I am trying to attach.

  8. #8
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Here you go. Used a Text Upload

    http://textuploader.com/dufq8

  9. #9
    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
    79,365

    Re: Screen Freezes When Calling HTTP Requests

    Yes, the code contains HTML (e.g. < Body >), which will trigger the error (sometimes ...).
    Last edited by AliGW; 04-12-2018 at 08:45 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: Screen Freezes When Calling HTTP Requests

    You're making the call synchronously, it should be asynchronous, like this:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    @AliGW & Kyle -

    Thanks for the replies..

    It worked as desired.

    Reps added..

    Cheers!
    Deep Dave

  12. #12
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi Kyle123 & AliGW,

    Thanks for the help so far.

    After a certain amount of time, my Excel times out. It works fine on the .net application, but not on Excel.

    Is there any method that can control the time out?? Or some other way maybe??

    Thanks

    Deep Dave

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

    Re: Screen Freezes When Calling HTTP Requests


  14. #14
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Quote Originally Posted by Kyle123 View Post
    Thank you sir..

    It does work as required. However the screen starts freezing again.

    However there is a difference.

    I have multiple rows. My screen used to freeze when the API is called for the 1st row and unfreezes after processing the last row.

    After making the call asynchronously, the screen Freezes and Unfreezes after each row.

    Can there be a solution to that??

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

    Re: Screen Freezes When Calling HTTP Requests

    Post your code please

  16. #16
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Quote Originally Posted by Kyle123 View Post
    Post your code please
    Here you go -

    http://textuploader.com/duiah

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

    Re: Screen Freezes When Calling HTTP Requests

    You've made the code synchronous again, the last parameter of the open method should be true, not false

  18. #18
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Quote Originally Posted by Kyle123 View Post
    You've made the code synchronous again, the last parameter of the open method should be true, not false
    I am extremely sorry, seems I changed it back by error.

    Sorry for the unnecessary trouble.

    Cheers!
    Deep

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

    Re: Screen Freezes When Calling HTTP Requests

    No need to be sorry mate, glad you got it sorted

  20. #20
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi,

    As soon as I turn it Async to True, I get this error on the Do Loop line.

    Even if I comment out the line, the same error occurs
    Attached Images Attached Images

  21. #21
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    I am using this line and it makes it work

    Application.Wait (Now + TimeValue("0:00:05"))

    A 5 Sec Overhead on each line is added unnecessarily?

    But is this the right approach?

    Sometimes 5 Seconds does not do it.. I need to have more

    Cheers!
    Deep
    Last edited by NeedForExcel; 04-19-2018 at 02:27 AM.

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

    Re: Screen Freezes When Calling HTTP Requests

    No, it's not the right approach. If you take out the timeouts line do you get the same error message?

  23. #23
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Yes.. I tried commenting that line it does return the error instantly as soon as I run the code.

    Only If I set the Async to false, it runs as required except the Screen Freezing issue.

    I am sorry for all these questions, its just that I am not very good with VBA

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

    Re: Screen Freezes When Calling HTTP Requests

    Try this - you'll need to set a reference to Microsfot XML v.xx:
    Please Login or Register  to view this content.
    Last edited by Kyle123; 04-19-2018 at 03:52 AM.

  25. #25
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi Kyle,

    Thank you for the response. I did get my service running.

    However, I still get the same error as mentioned in Post #20 when Async is set to True. If set to false, it code runs fine, just the screen freezes..

    1 thing I would like to know, what is the difference between using WINHTTP & MSXML2?
    Last edited by NeedForExcel; 04-19-2018 at 05:08 AM.

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

    Re: Screen Freezes When Calling HTTP Requests

    Could you post your actual code please?

  27. #27
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi Kyle, the Code is pretty big and has a lot of names (Variables, Constants, API Names) etc which I am not allowed to share. Changing all those would take a lot of time..

    The Code I posted is essentially the only code that causes trouble.

    The SOAP Envelope that uses the Input SN is basically number of simulations. If they are below 500 the screen does not freeze. When the number entered by the user is a large one, for example 7500, only then the screen starts freezing.

    The Web Service starts taking around 10-12 seconds to return the response.

    Hope that helps.

    Thank You,
    Deep Dave

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

    Re: Screen Freezes When Calling HTTP Requests

    I understand the issue, but I can't replicate your issue, the logical thing to assume therefore is that there's something different about how you've implemented the code, therefore I need to see it to be able to help. If you're sure that it's only the web call then all I need go see is the changes you've made to the getsl function, I don't need to see the rest

  29. #29
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Screen Freezes When Calling HTTP Requests

    Hi Kyle,

    Sorry for the late reply. I have been away for the past few days.

    Currently I am using the Excel with the screen freezing part, and the user says he does not mind it.. So I am gonna leave it for now.

    Thank you for the help

    Cheers!

+ 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. Replies: 2
    Last Post: 07-12-2017, 02:41 AM
  2. [SOLVED] Matching strings within long http GET requests and displaying matches
    By sd24801 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-17-2014, 02:42 PM
  3. Replies: 8
    Last Post: 01-30-2014, 03:12 PM
  4. Exploring HTTP requests, GET, POST, PUT
    By excelenergy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2012, 07:39 PM
  5. [SOLVED] Screen Scrolling Macro (VBA) freezes
    By kencoburn in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-21-2012, 01:07 PM
  6. screen updating calling descriptive statistics
    By diablo908 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-26-2009, 06:22 PM
  7. Exceeding Cell Limit with HTTP requests
    By josephrowan in forum Excel General
    Replies: 0
    Last Post: 04-20-2006, 09:30 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