PC Review


Reply
Thread Tools Rate Thread

Compile error when using Res=Inputbox

 
 
Corey
Guest
Posts: n/a
 
      19th Apr 2007
res = InputBox("Please enter a Customer Name here", "....")
I get an error with this NOW?
Why?
How to fix?


Corey....


 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      19th Apr 2007
Compiles fine here. Did you paste it in (sometimes browsers use
non-breaking spaces to indent - deleting the whitespace removes the
error)?



In article <(E-Mail Removed)>,
"Corey" <(E-Mail Removed)> wrote:

> res = InputBox("Please enter a Customer Name here", "....")
> I get an error with this NOW?
> Why?
> How to fix?
>
>
> Corey....

 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      19th Apr 2007
The Compile error says:
Variable Not Defined?
I removed the Spaces but they return and the same error occurs.

"JE McGimpsey" <(E-Mail Removed)> wrote in message
news:jemcgimpsey-(E-Mail Removed)...
Compiles fine here. Did you paste it in (sometimes browsers use
non-breaking spaces to indent - deleting the whitespace removes the
error)?



In article <(E-Mail Removed)>,
"Corey" <(E-Mail Removed)> wrote:

> res = InputBox("Please enter a Customer Name here", "....")
> I get an error with this NOW?
> Why?
> How to fix?
>
>
> Corey....



 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      19th Apr 2007
Corey,
That one line of code, as written, compiles.
Of course, you should be using Option Explicit, and then you would need to
Dim res.
There must be something else you are not including.

NickHK

"Corey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> res = InputBox("Please enter a Customer Name here", "....")
> I get an error with this NOW?
> Why?
> How to fix?
>
>
> Corey....
>
>



 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      19th Apr 2007
That was it Nick.
I changed my project to Option Explicit
Yet did not dim res as variant

Thanks

"NickHK" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
Corey,
That one line of code, as written, compiles.
Of course, you should be using Option Explicit, and then you would need to
Dim res.
There must be something else you are not including.

NickHK

"Corey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> res = InputBox("Please enter a Customer Name here", "....")
> I get an error with this NOW?
> Why?
> How to fix?
>
>
> Corey....
>
>




 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      19th Apr 2007
Then you need to define the variable...


Dim res As String

or

Dim res As Variant

You usually get that error when you have "Option Explicit" at the top of
your module. It's a GOOD thing. Keeps you from tearing your hair out
over thing like:

Dim result As String

'lots of code here

res = Inputbox("...")

'lots more code

If result = "foo" Then
'...

where result never gets assigned...

In article <(E-Mail Removed)>,
"Corey" <(E-Mail Removed)> wrote:

> The Compile error says:
> Variable Not Defined?
> I removed the Spaces but they return and the same error occurs.

 
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
error 91 and inputbox string goodfish Microsoft Excel Programming 3 30th Aug 2009 01:09 PM
Application.InputBox Error Clif McIrvin Microsoft Excel Discussion 13 1st Jun 2009 04:21 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Microsoft Excel Programming 1 13th Dec 2005 07:17 PM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" =?Utf-8?B?UVRQIFByb2Zlc3Npb25hbA==?= Microsoft Excel Misc 1 18th Nov 2005 11:47 PM
InputBox error Microsoft VB .NET 1 13th Nov 2003 08:19 PM


Features
 

Advertising
 

Newsgroups
 


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