Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBA Acting "Funny"

I have been trying to learn and write some VBA procedures in Excel on my
hope Excel version (XP). I wish to use these on my office version (2000).
They are quite simple but the 2000 acts strange in several ways that it
should not, based on what I keep reading in books and the help file.

First, I do not have to declare each and every variable on the XP version.
If they are not declared with a DIM statement then they are established as a
variant on first use. This matches what I read in all the books and the
help file in both versions.

Second, I try to create a carriage return in a message box by using
&Chr(13). It works fine on the XP version but the 200 version says,"
Compile Error: Cannot find project or library."

What am I missing here? Is there a setting in the 2000 versions that I
should alter?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default VBA Acting "Funny"

In article ,
"Shawn Shuler" wrote:

First, I do not have to declare each and every variable on the XP version.
If they are not declared with a DIM statement then they are established as a
variant on first use. This matches what I read in all the books and the
help file in both versions.


You don't have to declare variables with Dim unless your modules have
Option Explicit at the top.

However, *especially* if you're just learning VBA, it's an *excellent*
idea to put that Option Explicit in. You can do that automatically by,
in the VBE, choosing Tools/Options/Editor and checking the Require
variable declaration checkbox (which is probably the setting in your
2000 version).

Having Option Explicit causes the compiler to catch all kinds of errors
- from spelling to type mismatches, and makes the debugging process much
easier


Second, I try to create a carriage return in a message box by using
&Chr(13). It works fine on the XP version but the 200 version says,"
Compile Error: Cannot find project or library."

What am I missing here? Is there a setting in the 2000 versions that I
should alter?


I'm not sure why that would cause an error. You could try using a space
between the & and the Chr(13) instead.

However, I'd recommend, at least to start, that you learn the enumerated
value vbNewLine instead, only because it works cross-platform (WinXL and
MacXL), where Chr(13) doesn't.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VBA Acting "Funny"

I will try both of your suggestions. I appreciate the help.

"JE McGimpsey" wrote in message
...
In article ,
"Shawn Shuler" wrote:

First, I do not have to declare each and every variable on the XP

version.
If they are not declared with a DIM statement then they are established

as a
variant on first use. This matches what I read in all the books and the
help file in both versions.


You don't have to declare variables with Dim unless your modules have
Option Explicit at the top.

However, *especially* if you're just learning VBA, it's an *excellent*
idea to put that Option Explicit in. You can do that automatically by,
in the VBE, choosing Tools/Options/Editor and checking the Require
variable declaration checkbox (which is probably the setting in your
2000 version).

Having Option Explicit causes the compiler to catch all kinds of errors
- from spelling to type mismatches, and makes the debugging process much
easier


Second, I try to create a carriage return in a message box by using
&Chr(13). It works fine on the XP version but the 200 version says,"
Compile Error: Cannot find project or library."

What am I missing here? Is there a setting in the 2000 versions that I
should alter?


I'm not sure why that would cause an error. You could try using a space
between the & and the Chr(13) instead.

However, I'd recommend, at least to start, that you learn the enumerated
value vbNewLine instead, only because it works cross-platform (WinXL and
MacXL), where Chr(13) doesn't.



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
CELL("filename") acting Volatile? (in assoc. with PULL) [email protected] Excel Worksheet Functions 4 August 3rd 06 03:23 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Cell acting funny... Roz Excel Discussion (Misc queries) 3 January 6th 06 04:01 PM


All times are GMT +1. The time now is 10:13 PM.

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

About Us

"It's about Microsoft Excel"