+ Reply to Thread
Results 1 to 4 of 4

Background Macro with userform

  1. #1
    Registered User
    Join Date
    12-14-2007
    Location
    Ontario
    Posts
    19

    Background Macro with userform

    Hello all
    I am currently working on a project in which i have created a toolset which calls different subroutines stored in a module. Each button works fine. My problem is that I have decided that i would like to use a progress bar. I have a form which has 2 progress bars on it. The progress bar works well actually, when run by itself. The bar was taken from another website giving examples of how to create a progress bar using a UserForm.

    My actual Problem

    The user clicks a button on the toolbar and the "WorkMacro" is called. Inside the work macro i have placed a call to the openform sub which, opens the userform. The userform has code under the initilize subroutine which establishes the length and location of the bars. This is where the code stops. it does not go back to the "WorkMacro" My understanding is that as long as the userform is open, only code behind the userform can function. Is there any way to get around this and resume my "WorkMacro" while leaving the userform visible.

    In sections of my "Workmacro" i have placed a function which runs to update the userform one. This function is called the progress function. so it to follows the same problem. Everytime i want to resume my work function i need to close the form. even if i unload the form at the end of progress it will still flash the form fequently and would likely not be all that helpful. Suggestions would be greatly appreciated.

  2. #2
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226
    How about placing the later part of WorkMarco code, that is not resuming, in the UserForm Code, to be run by UserFrom_Initialise ?
    Alternatively : How about relocating all the stuff over to the UserForm Code?
    Just leave a one-liner that calls the UserForm to open?
    Regards,

    Gabor

    Protect trees.. maybe one day we need to climb back....

  3. #3
    Registered User
    Join Date
    12-14-2007
    Location
    Ontario
    Posts
    19
    Thanks Gabor,
    I did think of doing that but the problem that i see with that is the size of my WorkModule. If i want the progress bar to work for each subroutine within the module then i would need to create a userform for each of my subroutines. So then i'm getting alot more bulky than i would hope for. I had hoped there would be another way, but perhaps your option is the only option if I wish for that type of functionality.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Before adding any kind of Progress Bar I would always recommend streamlining the code. Some things to consider:

    Does it contain unnecessary Selects or Acivates?
    Do you use Loops that could be replaced by more efficient coding?

    Have you checked Andy Pope's website for examples?

    www.andypope.info
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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. macro to copy Wks selected using a userform
    By Andy Pope in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-10-2008, 09:56 AM
  2. Deleting Query Tables with a Macro
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2008, 12:16 AM
  3. vba to change macro file name
    By blackstar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-02-2007, 12:14 AM
  4. Read-only error using Form Button with Assign Macro
    By samf88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2007, 02:15 PM
  5. country finder lookup macro
    By theghost in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2007, 10:41 PM

Tags for this Thread

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