+ Reply to Thread
Results 1 to 5 of 5

Count UserForms in a collection of another VBA Project

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Count UserForms in a collection of another VBA Project

    Hi all,

    I'm adding multiple instances of a UserForm to a collection from my AddIn workbook

    Please Login or Register  to view this content.
    and then need to count these instances inside another workbook, which I am struggling to achieve. I am aware of below to get the number of forms in the same project.

    Please Login or Register  to view this content.
    but can this be done in another project too? Something like below?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Count UserForms in a collection of another VBA Project

    Short answer: no. You'd need a function/method in the other workbook to return the value. Why is it useful, out of interest?
    Rory

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Count UserForms in a collection of another VBA Project



    I built two addins, one with general features, one specifically for certain workbooks. For the sake of maintenance I want to call a procedure from the ribbon of the specific addin, but have that procedure load the userform from the general addin, to avoid duplication of userforms. Now since I created multiple modeless instances of that userform to show multiple product images at the same time, I need to loop through the userform collection and change the position of each userform depending on it's index in order to display the images in a certain order on the screen. Does that make sense?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Count UserForms in a collection of another VBA Project

    Then you'll need to add a function to the general add-in that returns the data you need, or one that simply does what you need directly. I don't really see much benefit in having two add-ins rather than just enabling/disabling some functionality based on which workbook is active.

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Count UserForms in a collection of another VBA Project

    hmm... will have to use a function somehow then I guess. The reason for two addins is that there are multiple developers each working on different projects, so actually there will be around 6 addins in total that are only installed if the corresponding workbook is opened. Though, there will always be two addins installed at the same time as there's a default addin doing some "control work" and storing basic functions and userforms. This is the only way I can think of to keep us sane with all the maintenance and simultaneous development.

+ 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] Complex Excel project with automatic email data collection
    By theblackrazor in forum Excel General
    Replies: 0
    Last Post: 09-03-2019, 08:34 AM
  2. [SOLVED] When a collection created bring another column value into the collection
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-21-2018, 04:33 AM
  3. Replies: 1
    Last Post: 06-12-2017, 09:20 PM
  4. Replies: 4
    Last Post: 10-30-2015, 01:30 PM
  5. [SOLVED] Performance of iteration through Words collection degrades as collection gets bigger
    By 6StringJazzer in forum Word Programming / VBA / Macros
    Replies: 7
    Last Post: 01-14-2014, 09:44 AM
  6. Replies: 2
    Last Post: 12-23-2011, 11:04 AM
  7. [SOLVED] Checking Options in UserForms Collection
    By monir in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-14-2005, 12:06 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