+ Reply to Thread
Results 1 to 9 of 9

UserForm help - display list of open workbooks except workbook userform code is in

  1. #1
    Registered User
    Join Date
    04-24-2013
    Location
    Cardiff
    MS-Off Ver
    Excel 2003
    Posts
    5

    UserForm help - display list of open workbooks except workbook userform code is in

    Hi all,

    Long time lurker first time poster here.

    I'd be grateful for some help. I've searched this problem but it's one of those cases where the solutions given don't actually work for me.

    I have a userform that lists all the user's open workbooks. I want it to not show the workbook the userform code is in.

    The code I've copied is
    Please Login or Register  to view this content.
    Appreciate the second sub is just to activate the desired workbook.

    My findings are the code above lists all open workbooks but this includes the one the code is in which isn't what I want.

    Many thanks.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Please Login or Register  to view this content.
    You could also add checking if workbooks.count > 1 - otherwise your list will be empty

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    04-24-2013
    Location
    Cardiff
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Perfect that's great, thank you so much both (obviously, both solutions worked)

  5. #5
    Registered User
    Join Date
    04-24-2013
    Location
    Cardiff
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Um, I spoke too soon. Although it achieves what I wanted you've broken the original code from activating the workbook selected from the userform's list.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    The only thing that has changed is there is one less workbook listed, I can't see how that could 'break' the DoubleClick code.

    By the way, that code doesn't check if a workbook is actually selected and if no workbook selected it that would cause an error

  7. #7
    Registered User
    Join Date
    04-24-2013
    Location
    Cardiff
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Hi,

    My mistake there, please accept my apologies.

    I was confused trying to add a way for the list to refresh on demand to account for the user closing and opening other workbooks. I thought just unloading the userform and showing it again would do this, but playing around found this not to be the case and my playing caused a bug. In the end I was able to achieve this with a button linked to this code

    Please Login or Register  to view this content.
    It seems missing activating ThisWorkbook first caused issues.

    Thanks again.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    If you used the code I posted then unloading and showing should work just fine for refreshing the listbox.

  9. #9
    Registered User
    Join Date
    04-24-2013
    Location
    Cardiff
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: UserForm help - display list of open workbooks except workbook userform code is in

    Thanks for letting me know Norie.

+ 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. [SOLVED] Open UserForm when workbook opens (and not the code editor)
    By GavJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 02:12 AM
  2. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  3. How to Open 2nd workbook from userform, then close 2nd Userform
    By bigfoot007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2012, 02:03 PM
  4. Open workbook via another workbook and not display userform
    By Khaos176 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2009, 02:17 PM
  5. [SOLVED] userform to display dropdown list of open XL files
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2006, 01:20 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