+ Reply to Thread
Results 1 to 4 of 4

Error during passing of UserForm to Sub

  1. #1
    Registered User
    Join Date
    05-01-2016
    Location
    Dubai
    MS-Off Ver
    2013
    Posts
    2

    Error during passing of UserForm to Sub

    I was working on code optimization.
    And came to a point, where i need to create a sub for repetitive procedures.
    Below is the code:

    Please Login or Register  to view this content.

    Problem is that on line "Do Until frm.Visible = False" it gives me error "Run-time error '438': Object doesn't support this property or method"

    Would be glad if you can help me.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Error during passing of UserForm to Sub

    The Visible property of a userform is marked as 'Restricted' in VBA. In other words, it's not available.

    Why do you show the userform modelessly and then loop until it is hidden? Can't you just show it modally which will pause the code in the procedure until the userform is unloaded (Assuming you don't need access to the underlying workbook)?

  3. #3
    Registered User
    Join Date
    05-01-2016
    Location
    Dubai
    MS-Off Ver
    2013
    Posts
    2

    Re: Error during passing of UserForm to Sub

    Quote Originally Posted by cytop View Post
    The Visible property of a userform is marked as 'Restricted' in VBA. In other words, it's not available.

    Why do you show the userform modelessly and then loop until it is hidden? Can't you just show it modally which will pause the code in the procedure until the userform is unloaded (Assuming you don't need access to the underlying workbook)?
    I do refer to a workbook, while userform is open (to select ranges).
    Which is why i need userform modelessly.

    How can i specify in VBA if UserForm is unloaded or not?
    Last edited by SanShiney; 05-01-2016 at 05:58 AM. Reason: added question

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Error during passing of UserForm to Sub

    Have a look at the RefEdit control (Right click the toolbox and select 'Additional Controls', Go find it in the list). This allows you to select ranges on the worksheet when the control has focus, even on a modal userform.

    It can be buggy, though.

+ 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. Passing an array to a userForm
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-19-2020, 03:58 PM
  2. [SOLVED] Passing a variable to a userform
    By OldMan62 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-08-2014, 12:58 PM
  3. passing variable from userform
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-31-2010, 08:22 PM
  4. Passing arg to UserForm to use in Initialize
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2009, 08:03 AM
  5. Passing Userform Listbox to sub causes type-mismatch error
    By Kleev in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2005, 04:05 PM
  6. Passing variables between Sub and Userform
    By jose luis in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-22-2005, 12:21 PM
  7. Passing variable from userform to module error
    By mworth01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2005, 12:47 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