Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2007

Tip: Looking for answers? Try searching our database.

Text into a VBA Text Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
donh - 09 Feb 2007 09:20 GMT
Hi,

I'm trying to create a touch screen keyboard so I can input a postcode/
zipcode into a user form (the users wont have a real keyboard).  I've
got a basic one working where text typed goes into worksheet cells.
But I could really do with it going into a VBA Text box within the
user form in real time.

Any help as always appreciated

DonH
Bob Phillips - 09 Feb 2007 09:56 GMT
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<=== change to suit

   On Error GoTo ws_exit:
   Application.EnableEvents = False
   If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
       With Target
           Userform1.Textbox1.Text = .value
       End With
   End If

ws_exit:
   Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

Couple of points.

The text enterd in the worksheet won't be transferred to the textbox until
it is Entered.

The form must be displayed modeless to allow worksheet input.

C hange the constant WS_RANGE value to your target cell, or a range of
cells.

Signature

HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> Hi,
>
[quoted text clipped - 7 lines]
>
> DonH
donh - 09 Feb 2007 10:44 GMT
> Private Sub Worksheet_Change(ByVal Target As Range)
> Const WS_RANGE As String = "H10" '<=== change to suit
[quoted text clipped - 46 lines]
>
> - Show quoted text -

Thanks Bob but although it works as suggested users wont have a real
keyboard (hence making a virtual one) and therefore cant press enter.
Can the text go directly into the textbox?  All finished form data
will be sent to another worksheet to form a database.

Many thanks

DonH
Bob Phillips - 09 Feb 2007 11:52 GMT
Don,

If they don't press Enter, how does Excel know that input is complete? And
how do the users move from cell to cell?

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

>> Private Sub Worksheet_Change(ByVal Target As Range)
>> Const WS_RANGE As String = "H10" '<=== change to suit
[quoted text clipped - 57 lines]
>
> DonH
donh - 09 Feb 2007 12:07 GMT
> Don,
>
> If they don't press Enter, how does Excel know that input is complete? And
> how do the users move from cell to cell?

Bob,

This is for a survey form intended for a kiosk type environment where
everthing is completed on a user form via a touch screen, moving from
field to field by touching the next tick box on screen.  I needed a
virtual keyboard so I could allow users to enter a post/zip code.    I
have no proof it works, its just something I'm trying to get to work.

Don
Bob Phillips - 09 Feb 2007 12:45 GMT
Sorry, I completely misunderstood how it would work, I thought you had some
sort of other input device. I am afraid I have no experience of touch
screens, so I will probably be of no assistance.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

>> Don,
>>
[quoted text clipped - 11 lines]
>
> Don
donh - 09 Feb 2007 12:59 GMT
> Sorry, I completely misunderstood how it would work, I thought you had some
> sort of other input device. I am afraid I have no experience of touch
[quoted text clipped - 25 lines]
>
> - Show quoted text -

OK Many thanks for your help

DonH
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.