+ Reply to Thread
Results 1 to 11 of 11

scroll simultaneously frames in class module

  1. #1
    Registered User
    Join Date
    11-25-2024
    Location
    Italy
    MS-Off Ver
    Office 365
    Posts
    13

    scroll simultaneously frames in class module

    Hi all,
    i have a userform with 3 frames created run-time (code below).
    Please Login or Register  to view this content.
    The frames should scroll simultaneously (frm1 and frm2 vertically, frm1 and frm3 horizontally). My problem is how to put the scroll events below into a class module to achieve this. Any suggestion?
    Thanks in advance

    Please Login or Register  to view this content.

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

    Re: scroll simultaneously frames in class module

    Hi EXP88,
    You can create a class module at runtime, but why?
    You could import a premade class module.
    Last edited by pike; 12-29-2024 at 04:26 AM.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    11-25-2024
    Location
    Italy
    MS-Off Ver
    Office 365
    Posts
    13

    Re: scroll simultaneously frames in class module

    Hi pike,
    I don't need to create the class module at runtime, just the userform and the group of frames. In the meantime I have tried with the class module below, but it doesn't work. The code doesn't return any error, simply events don't trigger and i don't understand why.

    Please Login or Register  to view this content.
    class module (Frame_class):

    Please Login or Register  to view this content.
    Thanks

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

    Re: scroll simultaneously frames in class module

    Hi EXP88, you need to populate the user form with the frame scroll procedure code for the frame scroll control.
    you will need to access and write to the
    Please Login or Register  to view this content.
    via compiled stringcode
    Please Login or Register  to view this content.
    Its not as complicated as it sounds. I will return and add the syntax when i return .. beach is calling.

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

    Re: scroll simultaneously frames in class module

    EXP88 , how to add the syntax to the userform
    Please Login or Register  to view this content.

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

    Re: scroll simultaneously frames in class module

    here you go...
    Please Login or Register  to view this content.
    Last edited by pike; 12-27-2024 at 05:20 AM. Reason: Change this line... strCode = strCode & " frm1.ScrollLeft = frm3.ScrollLeft + ActualDy" & vbCrLf

  7. #7
    Registered User
    Join Date
    11-25-2024
    Location
    Italy
    MS-Off Ver
    Office 365
    Posts
    13

    Re: scroll simultaneously frames in class module

    It works perfectly, just a couple of questions:
    - what is the purpose of the variable blnhook?
    - it is possible also shown the userform vbmodelessy? I've notice that the property showmodal is commented, in fact the userform disappear immediately after shown
    thanks again

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

    Re: scroll simultaneously frames in class module

    Hi EXP88,
    The boolean is so the scrollbars dont trigger each other in a feedback loop of value changes.

    Don't think the vbext_ct_MSForm template is Modeless compatible or have a modal property to set and that is why it errors. Once the vbext_ct_MSForm useformer is created/saved/unloaded it will be shown in the modeless mode when opened again. It is a limitation with the old vbext_ct_MSForm pre-showmodal property which wasn't updated.
    Please Login or Register  to view this content.
    or you could try an export and import of the form.frm ...or just make the userform .. or just import a premade userform.

    Why do you need to programmatically generate the userform?

  9. #9
    Registered User
    Join Date
    11-25-2024
    Location
    Italy
    MS-Off Ver
    Office 365
    Posts
    13

    Re: scroll simultaneously frames in class module

    I’m trying to do a sort of interface to manage data where I have a main userform and the users open other userforms with different sets of controls depending on what they have to do (and userforms are removed when no longer necessary). Better if all vbmodeless since they might check files too but I didn’t expect this problem. Maybe better create a userform template and “copy” it?

    I have done some tests, if the userform is called again directly by name like “Userform1.show vbmodeless” all work, but if called using a variable, dictionary or function works inly if vbmodal (I’ll have more userform, so I can’t call it directly). I have tried to add a initialize and activate event to the userform and the second doesn’t trigger if vbmodeless.

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

    Re: scroll simultaneously frames in class module

    EXP88,
    You can reduce the number of userforms to a few templates and rearrange the userform size, Captions, Controls ect...
    The example attached is basic but can have input boxes, listboxes that are hidden and then move into the userform frame for interaction and output as required.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-25-2024
    Location
    Italy
    MS-Off Ver
    Office 365
    Posts
    13

    Re: scroll simultaneously frames in class module

    I'll try something similar
    thanks again

+ 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] Class Module Events : How to refering to individual class members
    By kev_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-29-2020, 06:27 AM
  2. How to simultaneously scroll userform labels with listbox?
    By freespirityu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2018, 07:31 AM
  3. Class Module to design a class based on an autoshape (arrow)
    By BluesEnd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2017, 07:23 AM
  4. VBA to have certain sheets scroll simultaneously
    By esbencito in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-18-2017, 10:41 PM
  5. Place code in userform, module or class module
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2017, 07:04 AM
  6. [SOLVED] ComboBox class .AddItem filled in class module
    By Jacques Grobler in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-03-2012, 05:48 AM
  7. Replies: 1
    Last Post: 08-30-2011, 02:23 AM

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