+ Reply to Thread
Results 1 to 7 of 7

Open another workbook for multiple userform event use.

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Open another workbook for multiple userform event use.

    Hello folks.

    The use of this userform is to find a customer reference number. Im using two combobox's and a textbox.value that are populated from another workbook.

    Though the way it is at the moment it opens the workbook and closes the workbook every time a new value is set to one of the combobox's.

    I want to open the workbook on the useform initialize and do everthink the useform need from it. And then on the userform terminate close the workbook. Or somehink to this equlivent so this process of finding the customer referance number goes faster.

    Im just a little unsure of the dimmension of the variables for each event. For the source workbook.
    Please Login or Register  to view this content.
    Thankyou.
    If you would like the thread title changes, let me know what to and ill do it straight away.
    Last edited by D_Rennie; 09-12-2009 at 11:13 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Open another workbook for multiple userform event use.

    Hi D_Rennie

    could you open the workbook in "Initalise" Form option and close the workbook
    in "Deactivate"
    Please Login or Register  to view this content.



    Go the Titans
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Open another workbook for multiple userform event use.

    So then with setting the variables somethink like
    Please Login or Register  to view this content.
    also can i set this variable on the Initialize and referance to it within the various events "click,change,ect"
    Pike, have you see the casino this week its all dressed up for the titans match.
    Last edited by D_Rennie; 09-12-2009 at 03:15 AM.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Open another workbook for multiple userform event use.

    Hey D_Rennie
    you can declare the demention x as Public in the form just below opiton explicit
    Please Login or Register  to view this content.
    then use it in your other subs
    but call x something like sWorkingBook
    S for string and then a unique word to limit any errors/conflict

    off to the footie

    Broncos are in trouble

    catcha

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Open another workbook for multiple userform event use.

    If you switch off screen updating then you only need open the workbook once, do all the actions then close it
    Hope that helps.

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

    Free DataBaseForm example

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Open another workbook for multiple userform event use.

    Still having trouble setting the variable for use in all events, though i think it is becouse VBA wants to set the public variable 1st and then run the intilze. So i would need to set the public as string. Anyhow im not going to worry about it becouse i am only saving 3 lines.
    >> It was a great game of football, just when i though GC was getting up Broncos socred again. >> Broncos have a lot more final's football experience and came out hard and keeped the pace.
    >>
    Im happy with how this is working. Nearly all my excel files are now working together.

    cheers guys.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Open another workbook for multiple userform event use.

    the other option is when the comboboxs are clicked they run a combined sub
    that checks to see if file opens
    case statements of each combobox
    then on close userform if open close file

    broncos to good

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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