PDA

View Full Version : Need comments



avadhutd2
11-16-2009, 12:16 AM
I was navigating through the MSDN for a certain help and incidentally I came across the information below. Please refer the underlined part.

Just want to know, when they say recent version, which version fall under that?





Microsoft Office XP Developer
The Integer, Long, and Byte Data Types
Three data types in Microsoft® Visual Basic® for Applications (VBA) can represent integers, or whole numbers: the Integer, Long, and Byte data types. Of these, the Integer and Long types are the ones you are most likely to use regularly.
The Integer and Long data types can both hold positive or negative values. The difference between them is their size: Integer variables can hold values between -32,768 and 32,767, while Long variables can range from -2,147,483,648 to 2,147,483,647. Traditionally, VBA programmers have used integers to hold small numbers, because they required less memory. In recent versions, however, VBA converts all integer values to type Long, even if they are declared as type Integer. Therefore, there is no longer a performance advantage to using Integer variables; in fact, Long variables might be slightly faster because VBA does not have to convert them.
The Byte data type can hold positive values from 0 to 255. A Byte variable requires only a single byte of memory, so it is very efficient. You can use a Byte variable to hold an Integer value if you know that value will never be greater than 255. However, the Byte data type is typically used for working with strings. For some string operations, converting the string to an array of bytes can significantly enhance performance.

Reference – http://msdn.microsoft.com/en-us/library/aa164754(office.10).aspx





Can anyone please let me know is this is a best practice.

Also I need some best practices to implement in my work....if possible can I get the any document or links that will list VBA best practices to be followed ??

Thanks!

Bob Phillips
11-16-2009, 01:34 AM
This is a best practice that I have been advocating for years, I have never seen MS state it before so that is usefujl. By Recent, I think they mean any 32 bit OS, which I think you can safely assume the vast majority of people have.