Posts by SamDsouza


    Anyone who has designed a textbox with Date Format ie with DD-MMM-YYYY through Class Event. Though in Class Event Textbox dont have Exit, Enter, BeforeUpdate and After update so become difficult for the result when numeric values entered in the text box and result to be displayed in date format through beforeupdate or exit event

    though the above is possibe for a textbox designed on the userform and then form initialized and not at run time
    the code for the textbox exit event below which enters numeric values to form the date on Userform below as follows. in similar way would like textbox with Date format when form loaded at run time with Class Module Event


    One question

    Will it be advisable to create new class for different user forms or can i use the same clsObjectHandler for diffferent userform.
    Eg if userform2 is loaded with Textboxes and out of them some boxes with same type of Numeric keypress and ReadOnly but in userform the Textbox will have different control name. will this do

    Thank you so much for your guidance. :) Now Slowly getting grip with class events.

    Thanks John_W for the link by Reafidy.

    in clsObjHandler

    Thanks Sam


    Any idea In Class1 KeyPress_Event How do i get the name of textbox whose name property has been changed to "txtbx" & i when loaded on Userform1 at run time.
    Able to load the form with 25 textboxes but dont know how to get the name of textbox in keypress event of Class Module. After getting the name i want that textbox to KeyAscii = 0

    Private Sub UserForm_Initialize()
    Dim i As Integer
    Dim newTextbox As MSForms.TextBox
    Dim x As Integer
    Dim y As Integer
    x = 20
    y = 20

    For i = 1 To 25
    Set newTextbox = Controls.Add("forms.textbox.1")

    With newTextbox
    .Name = "txtbx" & i
    .Top = y + 20
    .Height = 18
    .Left = x
    .Width = 150
    .Font.Size = "10"
    .Font.Name = "Calibri"
    End With
    y = y + 20
    Next i

    End Sub


    Re: To Disable or GreyOut Normal, Page Layout, Page Break View from "View" Tab using

    Thank you so much :rock::rock:
    You made my module completely Disappear Thats Great :jumpupdo::cheers:

    works perfectly in Excel 2007 but in excel 2013 XML pointed the following


    "Custom UI xml namespace must be
    <customUI xmlns="">

    So Changed it. Can the schemas be common for all the version of Excel from 2007 to 2013

    Thanks Once again:thanx:


    just began to explore XML and novice to it
    Basically want to disable or grey out the following toggle buttons i.e Normal, Page Layout and Page Break View from the "View" Tab
    The reason is very clear to disable the same as one could easily modify the Footer and Header even if it is coded.
    Following is the XML Code which is Well Performed when Validated. The below following is adopted from Mr. Excel thread no 827397

    Somehow i am not able to disable or greyout Normal, Page Layout and Page Break View toggle buttons

    Following code in Module

    Your Help and guidance will be appreciated



    Re: Excel Userform - Update value based on multiple textboxes on command button click



    i've not gone through your file, I tried with 5 textboxes with the below code



    Val(.Caption) + 1

    indicates the number of counts of Next Button or CommandButton1




    the topic of images is very new to me though browsed few threads and worked on the file which is attached

    I am trying to make a small proj on data description with images where i select the image from a folder "Image-Trials" which displays the file name in combobox and its imagebox1.

    I select the image and load into imagebox2 and type its description in textbox
    First how do i store the first Image in the array.

    I want to add a new record by pressing Next. My imagebox2 should be able to store the first image and be ready for the next selected loaded image.

    With pressing next command and previous command will see all the records with its respective selected images in imagebox2

    One needs to create folder "Image-Trials" with few jpg images for checking.



    Re: Problem Saving the Data file and also when File Opened


    If you make the ListBox MultiSelect it will interfere with code that fills the TextBox and ComboBox

    From Post 1 itself as file attached listbox was multiselect. if not mistaken from combobox and textbox it filters the listbox
    How will it interfere with code which fills TextBox and ComboBox. ?
    Will it interfere as per your coding and as file attached by you or by my coding as per file attached in post1.


    I originally asked for a clear outline of what the project is supposed to do.


    Well Step by step Explanation follows


    1. Will Be Selecting School as Per Area (Selection and Addition)

    Combobox displays the Respective Areas
    Listbox displays the schools in that Area

    2. I Select and add

    3. View sheet3_Click : To view sheet3 Basically a Zonewise Report i.e the reason
    wanted to save the Selected and Added Schools in a sequential method
    Files will be saved as Zone.Dat etc
    View sheet3_Click functions perfectly till the point i select and add schools as per the desired formatting

    Problem Occured When
    I created one file with .dat from Outside to check

    1. Variables were read perfectly in Textbox and Combox and listbox Except for 1st record which did not read in textbox, combobox and
    in listbox it did not display its first item but displayed 2nd 3rd and so on
    When Next command clicked it reads perfectly the 2nd record in textbox and combox and all the items in Listbox of that 2nd record
    i.e all the schools of 2nd Area

    Some how 1st record of textbox and combox and 1st item of listbox of 1st record does not read at all.
    1st Area and its 1st School did not display at all

    2. When View Sheet3_click was pressed with above input .dat file none of the records were displayed except for the Formatting part of it.

    3. Tried coding for saving Seqeuntial method but everything read as 0.

    Hope this clarifies

    Re: Problem Saving the Data file and also when File Opened

    Yes filtering listbox by area for multiple schools i.e the reason
    i asked you to


    [INDENT]Actually listbox1.MultiSelect = fmMultiSelectMulti
    listbox1.liststyle = fmListStyleOption
    pl change to above will enable us to select and add[/INDENT]


    I don't see why you need the ComboBox as the selection is made in the ListBox

    as per your only single data gets selected for Area. There are multiple schools in the Area

    Re: Problem Saving the Data file and also when File Opened

    Ok Fine


    The areas are listed in the ListBox and I have added code that allows the user to click a selection that then populates into the TextBox. You can now select from the ListBox using the buttons or simply by clicking on a record

    Beautiful. but can this be added at present it only selects. Also the combobox change event is not triggred as per your REMing


    I have no idea why you would use the TextBox change_event. This would trigger each time a character is changed.

    Well Keyascii = 0 for textbox will be coded so no character will be changed
    Actually TextBox change_event is triggered on ComboBox1 Change-event. In combobox i select the area and same displayed in textbox
    On basis of Area Selection (Combobox) the list of schools should display. then i click on select and Add as per the choice may be all schools or the selected ones
    this will only add or display the selected added school of that area
    Pl check the file atchd as per post 1

    Re: Problem Saving the Data file and also when File Opened

    Vow Thanks for Tidying the UF1.

    Have gone thru the file and seen REM Marks in Few Procedures.

    Will i be able to select from ComboBox ie cboArea because the areas are not displayed in Listbox with Areas and its schools as per cboArea.

    The reason for select and Add was to Select Areas and their respective schools and SAVE them as Zonewise. (Refer Point 1 and 2 as per Post 3
    File saved will be from UF2. Very clear saving a file will be of Sequential Output method. and to clarify further will not save as Xlsx file for now.


    Formatting a sheet everytime is inefficient

    Reason for Viewing / formatting A sheet was to have neat presentation of the Areas Selected with their Schools for the Particular Zone.
    i.e why i wanted to View Sheet3 with it contents when i have Selected all the Areas and added.

    For future when i open a saved file (zonewise) (Sequential Output file) from the list and I should be able to view the same in Sheet3 which did not happen as per post #1

    Re: Problem Saving the Data file and also when File Opened

    Ok. Implemented the "With" Statements. Good One:thumbcoo:
    The reason of formating the sheet every time when opened by chance if sheets gets deleted. Really thought of coding it to prevent manual adjustments too
    Awaiting your further views and amendments

    Re: Problem Saving the Data file and also when File Opened

    Really Going Crazy.

    As per Post #1 First tried to work on Problem 2.

    Now addtional Problem is the Textbox1 and ComboBox values of 1st record are blank.
    Not really able to point out what is going wrong. :spank: :hammerhe:
    Why is the 1st record showing blank in TextBox, combobox and 1st item in listbox but other items are seen in list box of 1st record:hammerhe:

    Using at present Excel 2013 Also tried to work the same in Excel 2007 but i get same :mad::mad::mad: :mad:
    I wonder how will i be able to resolve Problem 1 and 3 of Post #1 if the above presists at the base or 1st stage.:spank: :mad: