PDA

View Full Version : Solved: Textbox onClick



dchapin
07-08-2008, 05:23 PM
Ok, I am hoping that I can explain this. I have a textbox, via a series of list boxes, the textbox is "loaded" with text, for example:

BeginsWith([FieldOrText], [Text])

This text will eventually be inserted into the document, but first I need to set the values of [FieldOrText] and [Text]. What I want to be able to do is click on [FieldOrText] and open a form or popup and allow the user to select the value. When the user clicks on the word [Text] the word [Text] wouldbe highlighted and the user would be able to type text.

I guess the starting question is, can I select the entire "chunk" [FieldOrText] using a single click?

Next, can the click also open a form based upon what is clicked on. [FieldOrText] opens formA, [Field] opens formB and so on.

I think, help with those questions will get me started and at that point I will be able to move forward. I have seen this idea in a piece of software called CodeVBA. It has a utility called "Line of code builder". I really like how it works to aid the user in creating code. The piece of software I am trying to create will insert the same type of idea into a word document.

As usual, a jump start would be greatly appreciated.
Dan

fumei
07-09-2008, 10:40 AM
I am not following this at all.

1. "textbox" It helps when mentioning things like textbox, to state what kind of textbox. Is it a text formfield (from the Forms toolbar)? An ActiveX textbox (from the Controls toolbar)? Is it a textbox on a userform? In the document?

2. "I have a textbox, via a series of list boxes" Huh? via a series of list boxes...what does that mean? I have no idea what you are trying to say here. What does "via" list boxes mean? I am completely baffled.

3. "the textbox is "loaded" with text, for example:

BeginsWith([FieldOrText], [Text])"

What? A textbox contains strings. Is:

BeginsWith([FieldOrText], [Text])

an actual string, including the brackets????

4. You state it is going to be "eventually" inserted into the document. That implies that the textbox is on a userform. Is it? if so, say so.

5. "What I want to be able to do is click on [FieldOrText]" Again, is this a string, in a textbox?

6. "the user clicks on the word [Text]" So [Text] (including the brackets) is a string...inside another string - BeginsWith([FieldOrText], [Text])???

I am quite confused.

dchapin
07-09-2008, 11:57 AM
....go to a site, quite lost and not even sure how to ask a question, what the correct syntax was, or much about the subject at all, and get ripped to shreds about every single thing you wrote, making you quite afraid to come back and reply at all?

I think that you are doing a great job and really help a bunch of folks in the process (including myself), but perhaps there should be a beginners section on here, somewhere, where those of us with stupid question, asked improperly, can post our questions, without the threat of being publically flogged in the process. If I was an expert on VBA, I most likely would not be wasting your time. A simple, I do not understand, or can you post an example would have been super!

I am sorry for the confusion and/or trouble I will mark this solved, and revisit the question when I understand and know more about VBA and can post like an expert.

Dan

CreganTur
07-09-2008, 12:30 PM
Dan,

we just need some clarification about what you're trying to accomplish, because your initial question is a little hard to understand.

Like gerry asks, we need to understand what you mean by 'textbox', as there are many types of 'textboxes' in word, and we need to know exactly which type you are using. Is it a formfield in the body (text) of the document, or is this a textbox control (object) in a UserForm?

It sounds like you want your Users to select values from a series of listboxes, and then you want those values to be placed into the body of the document. Is this correct? If not then can you please explain what you're trying to accomplish?

fumei
07-09-2008, 12:48 PM
Hey, get a grip. I was not flogging you. I was stating I did not understand what you are asking. I did not rip you to shreds.

Is it ripping you to shreds to ask....?


what does that mean? I have no idea what you are trying to say here.

Is it ripping you to shreds to ask what kind of textbox you are asking about? I even volunteered the types of possible textboxes ( with the Forms toolbar? with the Controls toolbar?)

Is it ripping you to shreds to ask if the textbox you are asking about is in the document? Or on a userform?

Is it ripping you to shreds to ask if: BeginsWith([FieldOrText], [Text])

is an actual string?

I can not read minds. I do not know if that is a string, or not.

I asked. I asked in order to try and help.

I made absolutely no personal remarks about you. I did not "flog" you. I asked questions. I made NO comments about anything being a stupid question, so if you feel like I did, that is something you created yourself.

"A simple, I do not understand, or can you post an example would have been super!"

I did write a "I do not understand". I then tried to go into as much detail about what may be needed to help as I could.

For heaven's sake, calm down. You do not have to "post like an expert". You do, however, have to post clearly.

I tried to point out that:

"first I need to set the values of [FieldOrText] and [Text]"

is inconsistent with:

"the textbox is "loaded" with text, for example:

BeginsWith([FieldOrText], [Text])"

because if the textbox is "loaded" with the text - BeginsWith([FieldOrText], [Text]) - then that IS the text. A string. The value IS [FieldOrText], so what do you mean set the value?

I asked.

I asked: is [FieldOrText] a string (text), or not.

What is so hard about that?

I was not impolite, not did I flog you. I made no comment about you whatsoever.

You are quite welcome to ask beginner questions. We were all beginners. Try and be willing to give your best effort at answering questions asked back to you.

Sheeesh.

Now...do you want some help, or not?

It can start very simply.

1. what kind of textbox is this?

2. when you "load" the text with BeginsWith([FieldOrText], [Text]), then THAT is a string, text. How are you putting the text there?

3. What is [FieldOrText]? As there are square brackets, it may mean it is supposed to be a field, or something, but how can anyone know unless you state it is?

Your choice. You can walk away, or try to be clear. Your choice.

You were not "flogged"; you did not ask a stupid question, simply an unclear one. There are no stupid questions, and I never stated, or implied, that anything you wrote was stupid. If you feel that way, you made it that way yourself.

dchapin
07-09-2008, 12:59 PM
Certainly not the questions being asked but the method of asking them that got me riled up. I have really appreciated the help lately, but clearly just have to dot every i and cross every t before I post a question.

My textbox is located on a userform. I have played a bit the last day or so with a demo of CodeVBA which has a utility in it called "Insert Line of Code". This is really what I am trying to accomplish. Rather than inserting the completed line of code into vba, I want to insert the line of code into my document from the user form.

In CodeVBA (if you are not familiar) you select from a listbox, based on that selection, a second list box is populated, you select from the second listbox and a textbox or richtext box is populated with the base code. You can then click on parts of the base code and a popup or context menu appears allowing you to select a value or type text.

The "builder" I am working on will help the user to build a document that is used by a third party application. The word doc is imported into that app, and it uses the document text (field codes) to produce reports.

ya know, It doesnt matter how hard I try to explain this, it still sounds crazy and is not very understandable. I am hoping that you will know or know of CodeVBA. The site for codeVBA is http://www.code-vb.com/code_vba.htm.

Thanks Dan

fumei
07-09-2008, 01:00 PM
Know what? I am tired of this.

I accept that I can be more direct, and yes I admit brusque at times, than some people like.

If that is considered "flogging", then I do not belong here. I do not seem to have the finesse and diplomacy required. I am not paid for any assistance I may have given, and I sure as heck do not need this.

I think it is time to go.

Bye.