+ Reply to Thread
Results 1 to 7 of 7

Calendar selection not working for TextBox in frame

  1. #1
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    Calendar selection not working for TextBox in frame

    I got the pop up calendar in the attached file from torachan which I really like, but it is generating the error Run-time error'438': Object does'nt support this property or method.

    From scouring other forum posts I think the issue is something to do with the fact the TextBoxes that I want the date to appear in are in a frame (they were not in a frame when torachan originally gave me the calendar solution), but a solution is not that clear to me, so any help solving this would be much appreciated, or alternatively if you tell me frames are bad news and should be avoided that would also be helpful.

    To recreate error, open UserForm1, click in any of the date TextBoxes on bottom right of form and select a date.
    Attached Files Attached Files

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

    Re: Calendar selection not working for TextBox in frame

    Where are you using the calendar control?

    If you are using a frame you need to refer to the active control of the frame, not the userform - the active control of the userform will be the frame.
    Please Login or Register  to view this content.
    Last edited by Norie; 11-28-2020 at 07:41 PM.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Calendar selection not working for TextBox in frame

    As @Norie notes you need to recognise the frame as the control container.
    torachan

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    Re: Calendar selection not working for TextBox in frame

    Thank you both @Norie and @torachan, problem solved!

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Calendar selection not working for TextBox in frame

    @chris01395
    you had a previous question with regard filtering, on seeing the file attached it reminded me.
    I have attempted to incorporate it within your file, regrettably I have had to give up as there was too much editing to do and I had not the time spare.
    So I have attached something similar that I had posted to to previous members problem on similar lines.
    The textbox filters (similar to your small lists) however look at the coding for the large listbox - one lookup line compared to your 20+ lookups.
    The basics of the search on the filtered listbox are the list.listindex is used to identify the contents of a unique cell, this is then used to identify the table row, from which the textbox contents can be read in.
    The sheet is only read once, with your method using worksheet functions the sheet is read 20+ times making for a very slow program.
    Lastly the best tip ever, declare 'Option Explicit' as your very first program line, followed by all your variables at the head before any Subs, this allows the variables to carry between all Subs and when you run debug you will find error checking far more informative.
    Remove the apostraphe from the word "Stop" in the code to see the relationship between listindex and the search table row.
    torachan.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    Re: Calendar selection not working for TextBox in frame

    Thanks @torachan I will take a look at your file.

    I have now added the Option Explicit and it threw up several missing variables not being set, but I was able to to fix these pretty easily (so I must be learning something )

    Just to close out this calendar question, how do I alter code if I want to use it in multiple places for example in UserForm1.Frame2 and UserFrom3.Frame3 (more likely to follow); I tried the following with no success;

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Calendar selection not working for TextBox in frame

    Use @Norie's code - then look for the code below in the UserForm and add similar for your new textbox.
    Please Login or Register  to view this content.

+ 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. Adding Textbox as cooltiptext in a front of frame on userform
    By jaryszek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-22-2019, 05:21 AM
  2. Selection frame disappears in few seconds
    By dimate in forum Excel General
    Replies: 4
    Last Post: 09-24-2017, 09:30 PM
  3. Copy text from textbox in disabled frame
    By agrypas in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-25-2017, 01:25 AM
  4. [SOLVED] Userform VBA, textbox in a frame - runtime error 438
    By poolierob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2015, 12:09 PM
  5. Enable textbox in frame
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2010, 08:00 AM
  6. Insert a Textbox in a Frame during runtime
    By foxbeat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-15-2007, 06:34 PM
  7. Verify the format of the content of a textbox included in a frame
    By Edgar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2005, 08:05 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