+ Reply to Thread
Results 1 to 8 of 8

Yielding to others while macro is running?

  1. #1
    Registered User
    Join Date
    04-25-2013
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    58

    Yielding to others while macro is running?

    I have a project in which I build some kind of a loop that takes entry from user to update information on a database. At the end of each loop it will loop back to a userforms waiting for another item designation. It just sits there waiting until confirmation event to happen then it darts out of the barn again. The problem I am facing is that no matter how uneventful of that wait for entry, the macro is still considered to be in running state. I could not open any other excel workbooks at all. It will just block up any other excel processes.

    Is that any way around this design? I could let the user exit from the loop but the person will have to login again. If (s)he has to do lots of entries in a day while viewing other worksheets and excel documents in between it will be so tedious to log out and log in all the time.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Yielding to others while macro is running?

    Hello vientito,

    If I understand your issue correctly, then I would suggest you change the Userform Show as Modal to False.


    Regards
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Yielding to others while macro is running?

    Maybe instead of a userform have a worksheet with the buttons/entry boxes that you need and use that to call the macro.

    In essence, the macro runs, then hides all sheet except the "userform sheet" at which point the macro finished and the user regains control of excel. Once a button is pressed on the userform sheet, the macro runs again, or a cancel could hide the userform sheet and return the workbook to normal?

    Edit: Winon's suggestion may also work, code would be:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-25-2013
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Yielding to others while macro is running?

    it won't work. In fact, my userform is shown in modal-less form in implementation. In fact, I could even go on to my target worksheet to hightlight any cell in it while having my form displayed in the front. it is fine within the same excel application. I cannot click on any other excel workbooks and try to open them while this macro is in running state. They will all be blocked. Could an excel application be made to yield to another application and having all its states saved in doing so?

    I think the problem goes back to the fact that Excel inherently is not a multithreaded program.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Yielding to others while macro is running?

    Hello vientito,

    Thank you for the feedback.

    In that case we would need to see a sample of your Workbook, complete with VBA Code and Forms.

    Please upload a copy of same for us to have a look at for you.

    Regards.

  6. #6
    Registered User
    Join Date
    04-25-2013
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Yielding to others while macro is running?

    There is another constraint built in that forces me to adopt the way I am doing things right now. As long as the macro is active it will keep server aware of my presence to enable all HTTP accesses while the program is active. If at any point, the program is done for, somehow that knowledge is lost. I try to search for a cookie file but it does not seem to be around. I am not sure how the server knows me after I log in once. All subsequent HTTP calls are all good. But as soon as I finish the macro that information is lost.

  7. #7
    Registered User
    Join Date
    04-25-2013
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    58

    Re: Yielding to others while macro is running?

    Just to make a comment here that I have found my way out.

    What I understand so far that I could just as well open another excel doc by pressing shift while clicking an excel application to open another completely independent instance of excel application. This way it will not interfere with the first instance of the app where my macro is executing. But just clicking on an excel doc shortcut on my desktop in fact will go back to my original instance in which my macro is running and by default excel will block it. I think it is designed to protect a single thread application.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Yielding to others while macro is running?

    Hello vientito,


    What I understand so far that I could just as well open another excel doc by pressing shift while clicking an excel application to open another completely independent instance of excel application.
    That was one of the solutions I had in mind, but you were clever enough to sort it out for yourself.

    Well done!

    Regards

+ 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. Calling an excel macro with auto_open isn't yielding the same output as normal
    By camdiggy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2013, 12:16 AM
  2. Following UDF is NOT yielding result. Could you please where the problem is?
    By Bibek.Bhattacharyya in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-07-2013, 09:06 AM
  3. formula not yielding value from vlookup
    By vislavti in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2011, 01:28 PM
  4. Sensitivity analysis yielding same output in all cells
    By wmfinance in forum Excel General
    Replies: 1
    Last Post: 07-01-2010, 03:56 PM
  5. Ignore, or display blank for cell yielding #DIV/0!
    By jgray in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-03-2010, 11:24 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