Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default msgbox weird behaviour

I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default msgbox weird behaviour

You should post the relevant code so we can attempt to duplicate the error.

"JLR-Mart" wrote:

I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default msgbox weird behaviour

Try limiting what the user can enter: Type:=1 means a number:

Sub TryNow()
Dim myT As Double
myT = Application.InputBox("Enter a number...", Type:=1)
MsgBox myT
End Sub

HTH,
Bernie
MS Excel MVP


"JLR-Mart" wrote in message
...
I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default msgbox weird behaviour

The code is below, although the issue isn't with the user input it's about
different behaviour depending on whether the user submits his answer using
the okay button, the return key or enter key!

On Error Resume Next
RCHOSEN = Application.InputBox("Please enter the row number of the new
part's parent and then choose OK", title:="Please identify the parent of the
new part", Type:=1)
On Error GoTo 0

"Bernie Deitrick" wrote:

Try limiting what the user can enter: Type:=1 means a number:

Sub TryNow()
Dim myT As Double
myT = Application.InputBox("Enter a number...", Type:=1)
MsgBox myT
End Sub

HTH,
Bernie
MS Excel MVP


"JLR-Mart" wrote in message
...
I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default msgbox weird behaviour

The code worked ok for me.

What does "falls in a heap" mean?

How is RCHOSEN declared?

What is the user typing when it falls in a heap.

What line fails? (The application.inputbox line???)

Any chance you (or the users) have a programmable keyboard and something else is
represented by that enter key on the number keypad?

Are there any macros that could have stolen the function of that key?

Does this happen on everyone's pc -- or just a few? Is every user who has
trouble using the same type keyboard?

I don't have a guess, but with more info, maybe someone will.



JLR-Mart wrote:

The code is below, although the issue isn't with the user input it's about
different behaviour depending on whether the user submits his answer using
the okay button, the return key or enter key!

On Error Resume Next
RCHOSEN = Application.InputBox("Please enter the row number of the new
part's parent and then choose OK", title:="Please identify the parent of the
new part", Type:=1)
On Error GoTo 0

"Bernie Deitrick" wrote:

Try limiting what the user can enter: Type:=1 means a number:

Sub TryNow()
Dim myT As Double
myT = Application.InputBox("Enter a number...", Type:=1)
MsgBox myT
End Sub

HTH,
Bernie
MS Excel MVP


"JLR-Mart" wrote in message
...
I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???





--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default msgbox weird behaviour

I agree with Dave, the code behaves as it should including the use of the
Numeric Keypad Enter key. The code is not the problem and on a normal
keyboard there should be no problem using either of the enter keys.

"JLR-Mart" wrote:

The code is below, although the issue isn't with the user input it's about
different behaviour depending on whether the user submits his answer using
the okay button, the return key or enter key!

On Error Resume Next
RCHOSEN = Application.InputBox("Please enter the row number of the new
part's parent and then choose OK", title:="Please identify the parent of the
new part", Type:=1)
On Error GoTo 0

"Bernie Deitrick" wrote:

Try limiting what the user can enter: Type:=1 means a number:

Sub TryNow()
Dim myT As Double
myT = Application.InputBox("Enter a number...", Type:=1)
MsgBox myT
End Sub

HTH,
Bernie
MS Excel MVP


"JLR-Mart" wrote in message
...
I have a msgbox with an okay and cancel button and a box for user to input a
value (number). If the user types a number and selects OK or hits the return
key, then the macro executes fine. HOWEVER if the user inputs a number and
hits the enter key on the numeric keypad the macro falls in a heap.

Any ideas why, or does anyone know how I can restrict the user to only using
certain keys???




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird VBA Behaviour msnyc07 Excel Worksheet Functions 13 February 15th 10 08:04 AM
Weird WindowsMediaPlayer behaviour teepee[_3_] Excel Discussion (Misc queries) 1 October 26th 08 11:20 PM
Weird Behaviour of Code Carlo Excel Programming 11 November 9th 06 11:55 AM
Weird AddIn behaviour Trefor Excel Programming 18 September 15th 06 12:10 PM
Weird Cell Behaviour Matt[_33_] Excel Programming 14 October 18th 05 06:42 PM


All times are GMT +1. The time now is 01:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"