Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Compile error when using Res=Inputbox

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


Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Compile error when using Res=Inputbox

Compiles fine here. Did you paste it in (sometimes browsers use
non-breaking spaces to indent - deleting the whitespace removes the
error)?



In article ,
"Corey" wrote:

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


Corey....

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Compile error when using Res=Inputbox

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

"JE McGimpsey" wrote in message
...
Compiles fine here. Did you paste it in (sometimes browsers use
non-breaking spaces to indent - deleting the whitespace removes the
error)?



In article ,
"Corey" wrote:

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


Corey....



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Compile error when using Res=Inputbox

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" wrote in message
...
res = InputBox("Please enter a Customer Name here", "....")
I get an error with this NOW?
Why?
How to fix?


Corey....




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Compile error when using Res=Inputbox

That was it Nick.
I changed my project to Option Explicit
Yet did not dim res as variant

Thanks

"NickHK" wrote in message ...
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" wrote in message
...
res = InputBox("Please enter a Customer Name here", "....")
I get an error with this NOW?
Why?
How to fix?


Corey....







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Compile error when using Res=Inputbox

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 ,
"Corey" wrote:

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

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
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 05:37 PM.

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"