PC Review


Reply
Thread Tools Rate Thread

Application InputBox Type 8 Error

 
 
Neal Zimm
Guest
Posts: n/a
 
      9th Jan 2009
Hi All,
Code below is a paragraph from a testing sub that execs other procs and
feeds them TestRow.

TestRng and other vars are properly dim'd.

I don't understand why I get a microsoft has to close error. I use the
default as a text reminder to me. Msoft type 8, i guess, does not interpret
the text as a bad range address to give me the typical application input box
error msg when I forget to click a cell before clicking OK.

I've since changed the code below to use selection.row

Have I found a MSoft bug?

Thanks.

Get_TestRow: 'get a row#
On Error Resume Next
Set TestRng = Application.InputBox(sPrompt, Procname, _
"Click CANCEL to Exit Test", Type:=8)
If TestRng Is Nothing Then
If vbYes = MsgBox("Row not selected, END TEST ??", _
vbYesNo + vbDefaultButton2, Procname) Then

Exit Sub
Else
GoTo Get_TestRow
End If
End If

TestRow = TestRng.Row
Return

--
Neal Z
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      10th Jan 2009
There are some answers on this site.

http://microsoft-server-operating-sy...1/Default.aspx

"Neal Zimm" wrote:

> Hi All,
> Code below is a paragraph from a testing sub that execs other procs and
> feeds them TestRow.
>
> TestRng and other vars are properly dim'd.
>
> I don't understand why I get a microsoft has to close error. I use the
> default as a text reminder to me. Msoft type 8, i guess, does not interpret
> the text as a bad range address to give me the typical application input box
> error msg when I forget to click a cell before clicking OK.
>
> I've since changed the code below to use selection.row
>
> Have I found a MSoft bug?
>
> Thanks.
>
> Get_TestRow: 'get a row#
> On Error Resume Next
> Set TestRng = Application.InputBox(sPrompt, Procname, _
> "Click CANCEL to Exit Test", Type:=8)
> If TestRng Is Nothing Then
> If vbYes = MsgBox("Row not selected, END TEST ??", _
> vbYesNo + vbDefaultButton2, Procname) Then
>
> Exit Sub
> Else
> GoTo Get_TestRow
> End If
> End If
>
> TestRow = TestRng.Row
> Return
>
> --
> Neal Z

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Jan 2009
If excel is crashing (and wants to close) because of this, it's not your code
that's the problem. I think you may want to consider rebuilding your workbook.

If you copy the code to a new workbook and put in just enough test data, I bet
excel won't crash that hard.

ps.

If you're looping through that code, I'd make sure that the range variable is
reset to nothing before you do the application.inputbox:

set testrng = nothing
On Error Resume Next
Set TestRng = application.inputbox(...)
on error goto 0

if testrng is nothing then
....

=====
but this change doesn't have anything to do with excel crashing. But it may
stop your code from crashing (or doing the wrong thing <vbg>).

Neal Zimm wrote:
>
> Hi All,
> Code below is a paragraph from a testing sub that execs other procs and
> feeds them TestRow.
>
> TestRng and other vars are properly dim'd.
>
> I don't understand why I get a microsoft has to close error. I use the
> default as a text reminder to me. Msoft type 8, i guess, does not interpret
> the text as a bad range address to give me the typical application input box
> error msg when I forget to click a cell before clicking OK.
>
> I've since changed the code below to use selection.row
>
> Have I found a MSoft bug?
>
> Thanks.
>
> Get_TestRow: 'get a row#
> On Error Resume Next
> Set TestRng = Application.InputBox(sPrompt, Procname, _
> "Click CANCEL to Exit Test", Type:=8)
> If TestRng Is Nothing Then
> If vbYes = MsgBox("Row not selected, END TEST ??", _
> vbYesNo + vbDefaultButton2, Procname) Then
>
> Exit Sub
> Else
> GoTo Get_TestRow
> End If
> End If
>
> TestRow = TestRng.Row
> Return
>
> --
> Neal Z


--

Dave Peterson
 
Reply With Quote
 
Neal Zimm
Guest
Posts: n/a
 
      15th Jan 2009
Thanks Bob, seems like overkill for test data, but I'll give it a try.
--
Neal Z


"Bob Flanagan" wrote:

> Most likely you have some corruption on your worksheet which is causing the
> inputbox function to fail. Modify your code and use a userform with a
> refedit control on it.
>
> As info, I have seen quite a few times where input boxes fail due to
> worksheet corruption. In all cases, Excel keeps working, but yours may be
> just worse corruption.
>
> Robert Flanagan
> http://www.add-ins.com
> Productivity add-ins and downloadable books on VB macros for Excel
>
> "Neal Zimm" <(E-Mail Removed)> wrote in message
> news:41A315DC-AD22-483A-A245-(E-Mail Removed)...
> > Hi All,
> > Code below is a paragraph from a testing sub that execs other procs and
> > feeds them TestRow.
> >
> > TestRng and other vars are properly dim'd.
> >
> > I don't understand why I get a microsoft has to close error. I use the
> > default as a text reminder to me. Msoft type 8, i guess, does not
> > interpret
> > the text as a bad range address to give me the typical application input
> > box
> > error msg when I forget to click a cell before clicking OK.
> >
> > I've since changed the code below to use selection.row
> >
> > Have I found a MSoft bug?
> >
> > Thanks.
> >
> > Get_TestRow: 'get a row#
> > On Error Resume Next
> > Set TestRng = Application.InputBox(sPrompt, Procname, _
> > "Click CANCEL to Exit Test", Type:=8)
> > If TestRng Is Nothing Then
> > If vbYes = MsgBox("Row not selected, END TEST ??", _
> > vbYesNo + vbDefaultButton2, Procname) Then
> >
> > Exit Sub
> > Else
> > GoTo Get_TestRow
> > End If
> > End If
> >
> > TestRow = TestRng.Row
> > Return
> >
> > --
> > Neal Z

>
>
>

 
Reply With Quote
 
Neal Zimm
Guest
Posts: n/a
 
      15th Jan 2009
Thanks Dave,
In the structure on the entire testing Sub, there is no looping, but
setting the range to nothing is a good standard, I forgot it in the shown
code, but usually do it.

--
Neal Z


"Dave Peterson" wrote:

> If excel is crashing (and wants to close) because of this, it's not your code
> that's the problem. I think you may want to consider rebuilding your workbook.
>
> If you copy the code to a new workbook and put in just enough test data, I bet
> excel won't crash that hard.
>
> ps.
>
> If you're looping through that code, I'd make sure that the range variable is
> reset to nothing before you do the application.inputbox:
>
> set testrng = nothing
> On Error Resume Next
> Set TestRng = application.inputbox(...)
> on error goto 0
>
> if testrng is nothing then
> ....
>
> =====
> but this change doesn't have anything to do with excel crashing. But it may
> stop your code from crashing (or doing the wrong thing <vbg>).
>
> Neal Zimm wrote:
> >
> > Hi All,
> > Code below is a paragraph from a testing sub that execs other procs and
> > feeds them TestRow.
> >
> > TestRng and other vars are properly dim'd.
> >
> > I don't understand why I get a microsoft has to close error. I use the
> > default as a text reminder to me. Msoft type 8, i guess, does not interpret
> > the text as a bad range address to give me the typical application input box
> > error msg when I forget to click a cell before clicking OK.
> >
> > I've since changed the code below to use selection.row
> >
> > Have I found a MSoft bug?
> >
> > Thanks.
> >
> > Get_TestRow: 'get a row#
> > On Error Resume Next
> > Set TestRng = Application.InputBox(sPrompt, Procname, _
> > "Click CANCEL to Exit Test", Type:=8)
> > If TestRng Is Nothing Then
> > If vbYes = MsgBox("Row not selected, END TEST ??", _
> > vbYesNo + vbDefaultButton2, Procname) Then
> >
> > Exit Sub
> > Else
> > GoTo Get_TestRow
> > End If
> > End If
> >
> > TestRow = TestRng.Row
> > Return
> >
> > --
> > Neal Z

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Neal Zimm
Guest
Posts: n/a
 
      15th Jan 2009
Thanks JLG,
I read the site, but for me it seems like overkill, but I'll keep the
references in mind.

--
Neal Z


"Neal Zimm" wrote:

> Hi All,
> Code below is a paragraph from a testing sub that execs other procs and
> feeds them TestRow.
>
> TestRng and other vars are properly dim'd.
>
> I don't understand why I get a microsoft has to close error. I use the
> default as a text reminder to me. Msoft type 8, i guess, does not interpret
> the text as a bad range address to give me the typical application input box
> error msg when I forget to click a cell before clicking OK.
>
> I've since changed the code below to use selection.row
>
> Have I found a MSoft bug?
>
> Thanks.
>
> Get_TestRow: 'get a row#
> On Error Resume Next
> Set TestRng = Application.InputBox(sPrompt, Procname, _
> "Click CANCEL to Exit Test", Type:=8)
> If TestRng Is Nothing Then
> If vbYes = MsgBox("Row not selected, END TEST ??", _
> vbYesNo + vbDefaultButton2, Procname) Then
>
> Exit Sub
> Else
> GoTo Get_TestRow
> End If
> End If
>
> TestRow = TestRng.Row
> Return
>
> --
> Neal Z

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.InputBox Error Clif McIrvin Microsoft Excel Discussion 13 1st Jun 2009 04:21 PM
Application.InputBox error trapping Rafi Microsoft Excel Programming 2 9th Feb 2009 09:05 PM
type mismatch and/or obj req error from inputbox goaljohnbill Microsoft Excel Programming 2 2nd Nov 2007 04:13 PM
Type Mismatch Error when using InputBox Method =?Utf-8?B?QW5vbGFu?= Microsoft Excel Programming 1 22nd Nov 2005 07:35 PM
Problem with focusing on Application.Inputbox type:= 8 masayoshi hayashi Microsoft Excel Programming 0 16th Sep 2004 10:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:36 PM.