+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25

Thread: UserForm Query

  1. #16
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: UserForm Query

    cfr the attachment, without bookmarks but with documentvariables.
    Attached Files Attached Files



  2. #17
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Thanks for the attachment...I'm currently pawing over it...trying to understand it.

    I'm guessing that you maybe created the userform from scratch from the images, either that or the one in the .dot file was so long winded...

    Anyhow the output is a little different from mine so I'm having a play with it.

  3. #18
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Can I ask you a couple of questions (basivally as this is all new to me)...

    1. What is the significance of using "J" as the variable name.
    2. What is the significance of the Tag statement, and why have spaces between some of the "" and other don't.
    3. What within the code allows for the format (spaces) between each of the text lines?

    Cheers,

    Andy

  4. #19
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Sorry...vbCr creates the carriage returns...got that bit.

  5. #20
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: UserForm Query

    1. systematic programming habit: first loop 'for j=1 to' , first nested loop 'for jj=1 to', second nested loop 'for jjj =1 to' , etc.
    2. tag="" perform the event, tag=" " do not perform the event. It's an alternative for application.enableevents = false, that doesn't work in a userform. This method is necessary to prevent endless loops.



  6. #21
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Thank you for all your help so far...

    I need to put in a combobox prior to one of the question textboxes, with some predetermined responses, code below...

    How do I set the textbox to display what is selected in the combobox if no entry is made in the textbox itself. I also have a default text line for the combobox but with the method I have used it automatically displays in the textbox, unless an alternative selection is made.

    If no selection is made in the textbox, I need the textbox to dislay what has been typed in it.


    PHP Code: 
    Private Sub UserForm_Initialize()
    ComboBox1.AddItem "test answer 1"
    ComboBox1.AddItem "test answer 2"

    If TextBox4.Text "" Then
    TextBox4
    .Text ComboBox1
    Else
    TextBox4.Text TextBox4

    End 
    If

    End Sub 
    Cheers,

    Andy

  7. #22
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: UserForm Query

    Pleas, use the correct code tags !!

    Never use additem to populate a combobox/listbox but use '.List'

    Private Sub UserForm_Initialize() 
      ComboBox1.List=array("answer 1" ,"answer 2","answer 3")
      textbox4.text=combobox1.list(0)
    End Sub



  8. #23
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Sorry about the tags, and again thank you for you help.

    I'm nearly done with thisnow, I just have a few more questions, shown below...I have also attached the updated file.

    1. Can the date textbox be replaced with some sort of date picker, rather than having to manually type in a date. It needs to be formatted to “ddMMMyy” when submitted.

    2. What can I replace combobox1 with in order to make multiple selections, which would be displayed in the document as “PERSON #, PERSON #, PERSON #...etc” on pressing of the submit button.

    3. The main ‘free-text’ textboxes e.g. textbox4 will be formatted in the same way i.e. Sentence Case. How can I specify that any DAY or MONTH names are displayed in UPPERCASE in the document when submitted.

    4. At the moment, if the user starts keying in text into textbox4 and then deletes it to begin again it causes a run time error. Why is that?

    5. When the submit button is pressed the text is copied into the word document but it does not start on the first line?

    6. It also creates a word document with a line spacing of 1.15, with 10pt space after each line. How do I change that to 1.0?

    7. To make things easier I have elected to display anything selected in one of the ‘Question’ comboboxes on a separate line from any ‘Question’ textbox entries. However, even if nothing is typed into the textbox it still leaves a blank line in the word document. How do I stop that?

    8. How do I make the headings appear in BOLD in the word document?
    Attached Files Attached Files

  9. #24
    Registered User
    Join Date
    05-08-2009
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: UserForm Query

    Can anyone help with this....?

  10. #25
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: UserForm Query

    1. Can the date textbox be replaced with some sort of date picker, rather than having to manually type in a date. It needs to be formatted to “ddMMMyy” when submitted.


    You can use a combobox, filled with dates:

    combobox1.list=Filter([transpose(Text(today()+row(1:365),"ddMMMyyyy"))], "-")

    2. What can I replace combobox1 with in order to make multiple selections, which would be displayed in the document as “PERSON #, PERSON #, PERSON #...etc” on pressing of the submit button.

    You can only use multiple selections using a Listbox



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0