+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: UserForm Query

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

    UserForm Query

    Before I waste anyone's time I'm going to ask a question, as I've already asked on another forum and I've been told to forget it...not in so many words.

    Basically I am trying to create a UserFrom in Word 2007 which involves a multipage tool and some textboxes...seemingly nothing too taxing.

    However I am having some problems, due to the fact that what I know about VBA you could fit in the corner of a postage stamp...

    I assume that there is some overlap between VBA for both Excel and Word? Y/N.

    If so would someone on here be prepared to give me a nudge in the right direction and put my mind at rest. I'm pretty much googled out and the Word forums don't seem anything like as "lively" as excel ones (inc. this one)

    This is pretty much my last attempt, or I'm going to put the book down and give it up as a bad job.

    Here's hoping

  2. #2
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,260

    Re: UserForm Query

    I think the Word Object Model is quite a bit different to the Excel Object Model.

    You really need examples of Word VBA code rather than attempt to translate Excel VBA.

    My opinion only and I may be wrong.

    Regards

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

    Re: UserForm Query

    Word's VBA and Excel's VBA share a common vba library (str, format, split, join, filter, sqr, cstr, strconv, copyfile, dir, filelen, name, chdir, etc.).
    However Excel and Word are very different programs, so they also have an VBA library of their own. E.g. An Excel file is a 'Workbook', A Word document is a 'Document', Excel has 'cells', Word has 'Paragraphs', etc. But if you are familiar with both libraries, it's very easy to let those libraries communicate.



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

    Re: UserForm Query

    That's fine. I welcome and value your opinion, afterall you know far more than I ever will. I think I'll go with "best of three" or something in terms of responses...

    1 nil to "let it go Louie"

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

    Re: UserForm Query

    And what is your question concerning queries & userforms ?



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

    Re: UserForm Query

    Ooo, another post whilst I was replying...however sounds like 2 nil to "let it go Louie"....perhaps I was a bit premature with my best of 3, as I'm now resigned to locking myself in a dark room with an Enya **.

    BTW, sorry this thread is not exactly "informative". Moderators, please feel free to move or delete this thread as you see fit!

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

    Re: UserForm Query

    To SNB,

    At the risk of being chastised for cross-posting (as I have already stated I have asked this of "word specific" forums already and either have had no replies or had it suggested that I try something more in line with my capability...like switch my machine off...a little harsh I guess but a simple "no it can't be done" rather than "what do you want to do that for" would be easier to digest...

    Basically I am trying to create a UserForm that allows users to enter written text into various textboxes in response to specific questions. The UserForm is set up to closely matchthe format of a database into which the information will eventually be manually pasted. Why not just type the info directly into ther database I hear you ask?

    Good question...the reason is that the database automatically logs you out after a predetermined time if no activity is detected, therefore it is easy to loose your work, if for example, you need to take a toilet break...! Also once entries are submitted they are locked so that you cannot edit them in any way, only view them.

    Therefore users tend to paste an aide memoir from the database into word, type out their report, read/ amend it etc. as per the aide memoir, and then paste the completed article back into the database.

    What i'm trying to do is somewhat ****, yes, but in essence it should make the report creation a bit neater and more efficient.

    It has been suggested that I try Form/ Field controls instead...but ironically I cannot get the same level of conformity with them that I can with the UserFrom, given the smidgen of knowledge that I have.

    The specific questions I have at the moment are as follows...

    1. I can get a vertical scroll bar within a Multipage Tool which works when inputting data when the UserForm is "live", However I cannot get it to expand when in design mode, which is required to allow for the placement of numerous further TextBoxes, so that I don't have an OVERLY long UserFrom to start with.
    2.One of the textboxes is formatted for Sentence Case, but I also want to code it to automatically display MONTH and WEEKDAY names i.e. SATURDAY, JULY in capitals.
    4. Can a textbox be coded to allow for carriage returns, i.e. to produce paragraphs?
    5. Can a textbox be coded to spell check an entry when it is submitted prior to being displayed in the finished document (THIS IS NOT CRUCIAL - I'm jsut trying to be fancy!!)

    That's pretty much it at the moment.....apologies this is long-winded but I'm at the last chance saloon with this and, if the chap who has so far tried to put me off reads this he is likely to hunt me down and turn me into dog food.

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

    Re: UserForm Query

    1. I can get a vertical scroll bar within a Multipage Tool which works when inputting data when the UserForm is "live", However I cannot get it to expand when in design mode, which is required to allow for the placement of numerous further TextBoxes, so that I don't have an OVERLY long UserFrom to start with.
    2.One of the textboxes is formatted for Sentence Case, but I also want to code it to automatically display MONTH and WEEKDAY names i.e. SATURDAY, JULY in capitals.
    4. Can a textbox be coded to allow for carriage returns, i.e. to produce paragraphs?
    5. Can a textbox be coded to spell check an entry when it is submitted prior to being displayed in the finished document (THIS IS NOT CRUCIAL - I'm jsut trying to be fancy!!)
    Ad 1. It's not necessary to switch to design mode; We can create as many textboxes we want, we can show them (visible/unvisible) based on the user's input. No we never design real-time when the user uses the form (and we don't need to)

    Ad 2. No problem, we can do that real-time (using the 'change' event), or afterwards before writing to a sheet/document/database.

    Ad 3 (4). A texbox can be .multiline =true ; .enterbehavior=true

    Ad 4 (5) Why would you if Word has a spellchecker of it's own ? We can show the result to the user. We need his/her interaction to check the spellchecker.



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

    Re: UserForm Query

    SNB, you may just have made my flippin' day!

    In answer to your last post...as per the points raised...

    1. I think I have mislead you with an insufficent description of what I'm on about...

    On the Multipage tool I will be setting up 6 pages. Each page will contain approximately 6-7 textboxes, each with a height equal to approx. 84 (for ease of reviewing what is being written, as it can be quite lengthy). I have designed the UserFrom to be a certain height and width, to keep it relatively neat, however this of course means that not all of the textboxes can be displayed without scrolling vertically.

    Whilst when the UserForm is "live" for data entry the scroll bars are visible and work fine, I cannot add the required number of textboxes when designing the UserFrom without altering the height of the UserFrom (i.e. it wont scroll vertically), which would mean that the UserForm would be too long for the screen...hope this makes more sense!

    2. Not exactly sure what a "change event" is other than logically understanding the concept. I think I have encountered one of these in setting up the text box to a) automatically change the text to Uppercase when entered, and b) automatically changing the text to Sentence Case when entered.

    I think I understand the concept of what I want to code but don't know how to write it, i.e. specifying that when a particular word is encountered it automatically changes it to Upper Case.

    3. This is excatly what I wanted, now works a treat...thanks

    4. I quite agree....Once it dumps the info into the document I'll just run the spell checker.

    I also have a cunning plan regarding your point about making textboxes visible/ invisible based on user input...if I understand what you mean...but I'll expand on that later if that's ok with you...I just want to get the thing running for now.

    Lastly....THANK YOU!

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

    Re: UserForm Query

    I you have further questione, please post a sample workbook. Much easier talking...



  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Nowhere
    MS-Off Ver
    None
    Posts
    8,275

    Re: UserForm Query

    FYI, moved to Word Programming as it's not Excel related in any way.

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

    Re: UserForm Query

    Thank you...

    Hopefully it should be attached. The last chap kept telling me there was nothing there....but then the last chap said none of this could be done.
    Attached Files Attached Files

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

    Re: UserForm Query

    Can you please post it as a dot or doc file ?



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

    Re: UserForm Query

    For some reason it wont allow me to attach a .dot file. I have sent through a zipped dot.. see if that works...if not I will send through some jpegs which give you an idea of what i'm doing....
    Attached Files Attached Files

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

    Re: UserForm Query

    JPEGs if the latter didn't work...
    Attached Images Attached Images

+ 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