Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Problem with focusing on Application.Inputbox type:= 8

My environment is
Excel 2000 SR-1
Win XP

How would you get a focus on Application.InputBox type:=8 in another
worksheet if the function is called from a command button in a
worksheet? Because of the focusing problem when a user clicks on the
other sheet, [Enter] does not work, so the user has to click on OK or
Cancel button to finish. Here is a code I have:

There is a command button cmdB in a worksheet sh1.
In the sh1 worksheet module,

Private Sub cmdB_Click()
Dim data As Range
Dim CancelClick As Boolean
Dim Prompt As String
Dim Title As String

Prompt = "foo"
Title = "foo"

'Select a data range
Call DataSelect(data, Prompt, Title, CancelClick)
If CancelClick Then Exit Sub
'some code here
end sub

In a standard module,

Sub DataSelect(DataRange As Range, Prompt As String, Title As String,
CancelClick As Boolean)
Dim DAddress As String

On Error GoTo Canceled
DAddress = Selection.Address
Set DataRange = Application.InputBox(Prompt:=Prompt, Title:=Title,
Default:=DAddress, Type:=8)
CancelClick = False
Exit Sub
Canceled:
CancelClick = True
End Sub
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
inputbox and application.run macro1 Michael Joe Excel Programming 3 August 13th 04 09:34 PM
Application.Inputbox acting strangely Alan Webb Excel Programming 0 July 15th 04 09:21 AM
Application.InputBox with Default:=0 testing False bluhme Excel Programming 2 June 24th 04 12:35 PM
application.inputbox Murat Excel Programming 4 February 24th 04 11:38 AM
Application.Inputbox Question ndp Excel Programming 3 December 8th 03 06:12 PM


All times are GMT +1. The time now is 01:37 AM.

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

About Us

"It's about Microsoft Excel"