Results 1 to 4 of 4

Thread: Threads -vba background task

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    402

    Threads -vba background task

    Is it possible to run a VBA macro as a background task and as such will not lock up the UI or prevent other tasks from being carried out ?

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,391

    Re: Threads -vba background task

    This is one area where a DoEvents statement in the VBA Code at an appropriate point will allow you to continue to use the computer for other tasks while the VBA macro is processing your data.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    402

    Re: Threads -vba background task

    Thanks, Is there no way to define a new thread and start the task under the new thread like in vb.net

    It's the same application that the macro is running under that I want to continue to using

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Threads -vba background task

    Thanks, Is there no way to define a new thread and start the task under the new thread like in vb.net
    not that i have done it, but probably can be done, not as simple as vb.net, i would search in the vb6 forum for createthread
    depending what you are doing you could also use a timer (API timer), which i have done to make a clock keep running and updating the display, without locking the application
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width