Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Immediate window - Compile error

Hi,

Im in the middle of executing code. I have put a break point just after the
code has Read through the values in an Array called - arrwords.

I wanted to check whether the reading of array has been done properly, so
opened up the immediate window (Ctrl + G)
and wrote the following as it is (Stole from Chip's site)

? For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

I get a -- compile error : expected expression


But if i read through the array element by element then I dont get any
error.

? arrwords(4)
microsoft
? arrwords(3)
basic
? arrwords(2)
visual
? arrwords(1)
objects
? arrwords(0)
net

What am I doing wrong in the method of combining several lines of code in to
one single line of code.

Thanks a lot,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Immediate window - Compile error

Debugging that way from the Immediate window can be terribly painful.

From the View menu choose Locals Window then expand arrwords.

Another way is to go View | Watch Window
Then from the Debug menu, Add Watch
The expression would be arrwords

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Hari Prasadh" wrote in message
...
Hi,

Im in the middle of executing code. I have put a break point just after
the code has Read through the values in an Array called - arrwords.

I wanted to check whether the reading of array has been done properly, so
opened up the immediate window (Ctrl + G)
and wrote the following as it is (Stole from Chip's site)

? For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

I get a -- compile error : expected expression


But if i read through the array element by element then I dont get any
error.

? arrwords(4)
microsoft
? arrwords(3)
basic
? arrwords(2)
visual
? arrwords(1)
objects
? arrwords(0)
net

What am I doing wrong in the method of combining several lines of code in
to one single line of code.

Thanks a lot,
Hari
India



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Immediate window - Compile error

More easily, if you open the watch window, select arrwords in the code,
click and drag it into the watch window. As Rob says, you can click the +
sign then and see all the values.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rob van Gelder" wrote in message
...
Debugging that way from the Immediate window can be terribly painful.

From the View menu choose Locals Window then expand arrwords.

Another way is to go View | Watch Window
Then from the Debug menu, Add Watch
The expression would be arrwords

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Hari Prasadh" wrote in message
...
Hi,

Im in the middle of executing code. I have put a break point just after
the code has Read through the values in an Array called - arrwords.

I wanted to check whether the reading of array has been done properly,

so
opened up the immediate window (Ctrl + G)
and wrote the following as it is (Stole from Chip's site)

? For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

I get a -- compile error : expected expression


But if i read through the array element by element then I dont get any
error.

? arrwords(4)
microsoft
? arrwords(3)
basic
? arrwords(2)
visual
? arrwords(1)
objects
? arrwords(0)
net

What am I doing wrong in the method of combining several lines of code

in
to one single line of code.

Thanks a lot,
Hari
India





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Immediate window - Compile error

Hari,

Have to say I disagree with Rob, I think the immediate window is great for
debuggingh. But you have to use it correctly as with all things, and you
have a Debug.Print statemen t in there, so the print command (?) is not
needed,. You are trying to run some code, not check what a variable or a
statement returns.

Just do

For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

make sure N is defined in your code, as this construct is invalid
unfortunately

Dim N :For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N)
: Next N

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Im in the middle of executing code. I have put a break point just after

the
code has Read through the values in an Array called - arrwords.

I wanted to check whether the reading of array has been done properly, so
opened up the immediate window (Ctrl + G)
and wrote the following as it is (Stole from Chip's site)

? For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

I get a -- compile error : expected expression


But if i read through the array element by element then I dont get any
error.

? arrwords(4)
microsoft
? arrwords(3)
basic
? arrwords(2)
visual
? arrwords(1)
objects
? arrwords(0)
net

What am I doing wrong in the method of combining several lines of code in

to
one single line of code.

Thanks a lot,
Hari
India




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Immediate window - Compile error

Hi Bob,

Thnx for your post. Now am able to get the results.

you have a Debug.Print statement in there, so the print command (?) is not
needed

Initially I thought that -- ? -- and -- Debug.Print -- are synonymous. To
check the same, I tried the following :-

1) ? for i= LBound(arrWords) To UBound(arrWords): arrWords(i) :Next i
I again got a compile error : expected expression

2) for i= LBound(arrWords) To UBound(arrWords): Debug.Print
arrWords(i) :Next i
No error and correct results.

So for some time I was at my wit's end. Then I read very closely your
statement regarding -- You are trying to run some code, not check what a
variable or a statement returns.-- and
things became clearer.

Thanks a lot,
Hari
India


"Bob Phillips" wrote in message
...
Hari,

Have to say I disagree with Rob, I think the immediate window is great for
debuggingh. But you have to use it correctly as with all things, and you
have a Debug.Print statemen t in there, so the print command (?) is not
needed,. You are trying to run some code, not check what a variable or a
statement returns.

Just do

For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

make sure N is defined in your code, as this construct is invalid
unfortunately

Dim N :For N= LBound(arrWords) To UBound(arrWords): Debug.Print
arrWords(N)
: Next N

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hari Prasadh" wrote in message
...
Hi,

Im in the middle of executing code. I have put a break point just after

the
code has Read through the values in an Array called - arrwords.

I wanted to check whether the reading of array has been done properly, so
opened up the immediate window (Ctrl + G)
and wrote the following as it is (Stole from Chip's site)

? For N= LBound(arrWords) To UBound(arrWords): Debug.Print arrWords(N) :
Next N

I get a -- compile error : expected expression


But if i read through the array element by element then I dont get any
error.

? arrwords(4)
microsoft
? arrwords(3)
basic
? arrwords(2)
visual
? arrwords(1)
objects
? arrwords(0)
net

What am I doing wrong in the method of combining several lines of code in

to
one single line of code.

Thanks a lot,
Hari
India






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
Solver - error - Compile Error Nina Excel Discussion (Misc queries) 0 August 19th 08 09:41 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 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
Compile error in hidden module error Melissa Zebrowski Excel Programming 3 February 20th 04 01:29 PM


All times are GMT +1. The time now is 08:35 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"