Computing.Net > Forums > Office Software > Macro to request user type in information

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Macro to request user type in information

Reply to Message Icon

Name: James Weber
Date: June 4, 2009 at 01:44:21 Pacific
OS: Windows XP
Subcategory: Microsoft Office
Comment:

Hello,

I would like to write a macro that makes a small window pop-up (similar to an InputBox) that requests the user inputs a fair amount of text (a paragraph, or more) and allows multiple lines. This is then exported to a certain cell.

An InputBox only allows one single line of text. Is there some other type like this that would allow the user to type his text in? Similar actually to the text input box I'm using on this website. I can type lots of stuff, and start new lines if I like.

After that, once I have the information I'd like to be able to export this to a predefined cell. This is going to be for a report that users fill-in.

I can code the text exporting, I think, but could you please suggest how I'd make the text input stuff?

Thanks for any help!
James.




Response Number 1
Name: DerbyDad03
Date: June 4, 2009 at 10:05:22 Pacific
+1
Reply:

I don't really like it, but it works. If it does nothing more than give you some ideas, then I'm satisfied.

Assumptions:

- The text box that accepts the user input is the only shape on your sheet.

- The users will actually follow the instructions. This is a very big assumption.

Sub CreateInputBox()
'Prompt user With Instructions
  MsgBox "Click OK to enter text in text box." _
         & vbCrLf & vbCrLf & _
         "Hit Esc Twice after entering text."
'Create User Input Box
  ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 240#, 209.25, 325.5, 219#).Select
'Set Esc key to export text
  Application.OnKey "{Esc}", "ExportText"
End Sub


Sub ExportText()
'Select Text Box
  ActiveSheet.Shapes.SelectAll
'Export text
  Range("A1") = Selection.Characters.Text
'Delete text box
  Selection.Delete
'Reset Esc key
  Application.OnKey "{Esc}"
End Sub


Reply to Message Icon

Related Posts

See More


Calculate Scores VLOOKUP query



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Google Ads



Results for: Macro to request user type in information

user input in a macro by using vba www.computing.net/answers/office/user-input-in-a-macro-by-using-vba/1031.html

Macro to save w/ other name www.computing.net/answers/office/macro-to-save-w-other-name/7251.html

macro to save as www.computing.net/answers/office/macro-to-save-as/9693.html