PDA

View Full Version : Using Textboxes for Data Input



newk
02-24-2005, 04:05 AM
Hi Guys,

I have 3 fairly embarrassing 'How to' questions.

In word 2000:

1) Can I colour a text box so people know where to write but it not show up when printing. (If so HOW?)

2) How do I input text that will overwrite when selected without using Mailmerge/FILLIN features.

3) How do I change the default save name in Word. More specifically could I create a default doc name that starts 'Fax_[TodaysDate]_'

Thanks guys and please no **** taking!

fumei
02-24-2005, 08:33 AM
1. Clarify "textbox". Is one of those awful, yuck, shudder Insert > Textbox horrible things? Is it a Forms toolbar textbox (that is - a FormField textbox)? Is it a Controls toolbars textbox (that is - an ActiveX textbox)? Makes a big difference.....

2. "How do I input text that will overwrite when selected " - uh, overwrite what? What was taken from the textbox and inserted in the document? Overwrite what was previously in the textbox?

3.This could be adjusted in date format, but may give you an idea of how to proceed. This uses the Document_Close evnt to save the file as a name appended with the current system date.
Private Sub Document_Close()
ActiveDocument.SaveAs FileName:="whatever" & Date
End Sub

4. Huh? "Thanks guys and please no **** taking! " I have no idea what that means.

Anne Troy
02-24-2005, 09:04 AM
I wanna know what **** taking is, too. :)

newk: You might want to have a look at "Fill-In Forms" over at www.theofficeexperts.com/word.htm (http://www.theofficeexperts.com/word.htm), which shows you how to create forms. If data previously filled the form field, it will be "replaced" when you tab to that field and type.

Here's our KB article on saving documents with the date. Gerry's code, above, might be all you need, but the article contains instructions on how to use the code, too, which I suspect you might need.

http://www.vbaexpress.com/kb/getarticle.php?kb_id=46

newk
02-24-2005, 09:16 AM
Thanks for responding Gerry & the beautiful Dreamboat,


Sorry I wasn't specific enough. I have a doc which is fully automated. The only free form text is a textbox.


1) It is one of those horrible yuck insert>textbox. Basically I want to allow users to see where to type so they keep to a standard format instead of writing anywhere in the document. Therefore if it was say red they would see the area to type and click the mouse inside the box. However I don't want the red to output to the printer. Therefore it is red on screen but invisible on printout.


2) I would also like to write something inside the textbox like "Please type message here". This is so there is no confusion, 'This is where I want you to type'. However when the 'horrible yuck' textbox is selected this text is overwritten by default.


3) I haven't had a chance to test this but would it work if the user just clicked the save icon (floppy disk) on the toolbar. If so COOL! If not do you have any ideas.


As for 4) the ****'s are hiding a semi rude word for going to the toilet or taking the Mickey out of someone. I appreciate that these questions aren't quite in the same league as VBA express rightfully deserves therefore I was expecting at least one Duh!


Anyway thanks for all your help and I hope this better clarifies my problem.

Anne Troy
02-24-2005, 09:37 AM
LOL.
1. See the link I sent you to. Make it work for you. It's EXACTLY what you want. Follow ALL the steps. I also like to encourage people who are using it for a FORM form...you know--with lines and such--they should put it in tables whenever possible.
2. This is possible with the options at the link. There's a formfield property called Default Text. You type "Enter Company Name Here" or some such.
3. Is a tougher one to answer. We could answer all your Qs much easier if we knew:

a) are you using a template (as you probably should be)
b) how many people will use it? (1, 2 or a dozen?)
c) do you have a sample file you can upload here? (see "go advanced" button below the reply window)

If you can do all that, we can likely be more helpful start-to-finish, than stumbling along...

4. I think you misspelled TALKING 'cause you said **** TAKING?

newk
02-24-2005, 10:05 AM
OK Dreamboat, Since everyone?s so curious: I meant to write P*SSTAKING. It is a harmless expression in England often used, 'Don't take the p*ss!'.

Anyway onto the nitty gritty:

a)Yes it is a template
b)Around 250 people.
c)Please see attached.

Ps. That code for 'save on close' is COOOOL. Unfortunately not what I want. Is there a way of changing the filename through 'autosave' or 'saveas'.

Anne Troy
02-24-2005, 10:14 AM
If it's a template, you can replace the Save and Save as toolbar buttons with buttons that run the macro.

I see you have a userform. Why not just add a message box there? Use the textbox control from the control toolbox. I mean...that's all that's left, right? The message area?

How will you ensure users enable macros?

newk
02-25-2005, 02:49 AM
The templates will be held on a drive that will automatically enable macros so that won't be a problem.


I don't really want to put the message box onto the form as it'll make the form huge and look messy. Also users will probably show a little resistance believe it or not. It's not proper GOMS usability to allow users to be disheartend by a dialog box of a super size meal.

1 & 2) What I really need it a method of yelling "TYPE HERE". That way the user will click in the invisible textbox. Does anyone have any ideas?

3) I could assign the macro to the save button but I need them to fill out the end part. Therefore the file name would be 'fax_050225_xxxxxx' The xxxxxx bit they will personally name therefore the suggested method would not satisfy the requirement.

Thanks for all the time, effort and help. It is greatly appreciated :)

Anne Troy
02-25-2005, 08:37 AM
I'm not sure how drives enable macros.
And I'm not sure why putting a textbox with scrollbars on it makes a userform huge.

1 & 2) I described how to do this at the link. Is there a problem using it?

3) A coder (I am not a coder) should be able to edit that macro to bring up the save dialog instead of just saving it.

mdmackillop
02-25-2005, 09:01 AM
Why not try a macrobutton


Insert/Fields/Document Automation/MacroButton

In the displayed field, change the text to: MACROBUTTON NoMacro Insert your text here please!

newk
02-25-2005, 09:22 AM
Thanks Dreamboat for your continued patience on this topic.

I have solved point 3) so lets forget about that.

2 & 3) ohhhh I've got it. Sorry I was quite confused there. Yes I understand those Form fields now. I've never used them before that was my problem. I will give them a go now and get them to work for me.

I assume the prompt message 'enable macros' only comes up when the security settings on a PC are set to high. [Is this correct?]. For some reason on this drive it seems to bypass these security settings however now that you have made me think about it I am starting to worry. Do you know of a method to get around this just incase?

Just got your post mdmackillop, I will give that ago as well and let you know how I get on.

thanks guys :)

Anne Troy
02-25-2005, 09:40 AM
Security settings:

High: NO Prompt at all, and macros NOT enabled (not good)
Medium: Prompted to enable when opening a doc w/macros
Low: NO prompt, but automatically enabled

Some people will tell you that medium is best. However, I have not seen a macro virus in a very long time. Personally, I always use Low.

I have never heard of a DRIVE "bypassing" or anything like that. The security settings are set PER MACHINE. There is NO way to alter a user's security settings using Word or VBA.

I don't think you want MD's macro button because I don't think you can make it give you the color you want. With the form fields (see link), you can place the field in a 1-column, 1-row table cell and fill the cell with color. However, MD might be able to make you a macro that will remove that colored background once text has been entered into the cell. Also, the macro button does nothing to protect the rest of the document.

mdmackillop
02-25-2005, 09:41 AM
Re the macro warnings, try self-certification.
http://www.vbaexpress.com/forum/showthread.php?p=14470

mdmackillop
02-25-2005, 09:50 AM
Don't know about the protection element, it all depends if its required.


I don't think you can make it give you the color you want.

Add the macrobutton and then colour it as required with the highlighter. For regular use, create an Autotext entry of the mactobutton which can then be inserted at will by typing "mb[F3]" or whatever.

Thanks DB, never thought of giving it a pretty colour before!

Anne Troy
02-25-2005, 09:57 AM
Well...I think he wants the color to "prompt" the user. I imagine it the way I use conditional formatting to show blank form cells in Excel. Once the cell is populated, the conditional format goes away. So, I think he wants the color to "stop prompting" the user once they fill in the message area.

mdmackillop
02-25-2005, 03:39 PM
Try the following; The button code has been modified to incorprate a save macro using the name from the additional textbox, and the save path C:\Atest. The Close macro has been modified accordingly.

Anne Troy
02-28-2005, 10:58 AM
Yo, newk. I'm wondering how this went. :)