Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question about VB constants


I am using the GetAttr constant, with the reference being "P:\", and i
returns 48, when I would expect 16, because it is a directory. Wha
does the 48 reference to?
I know what the constants 0,1,2,4,8,16,32 mean. Is there a full listin
somewhere? I have also recieved the constant 22 for my "C:\"

Many Thanks in advance

Justi

--
turnerj
-----------------------------------------------------------------------
turnerje's Profile: http://www.excelforum.com/member.php...fo&userid=2569
View this thread: http://www.excelforum.com/showthread.php?threadid=47306

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Question about VB constants

48 is 16 + 32, so it means it has the attributes of directory and archive.

To check if your attribute is set, do something like

GetAttr(filename) AND 16

A non-zero result means it is set.

HTH

Bob

"turnerje" wrote in
message ...

I am using the GetAttr constant, with the reference being "P:\", and it
returns 48, when I would expect 16, because it is a directory. What
does the 48 reference to?
I know what the constants 0,1,2,4,8,16,32 mean. Is there a full listing
somewhere? I have also recieved the constant 22 for my "C:\"

Many Thanks in advance

Justin


--
turnerje
------------------------------------------------------------------------
turnerje's Profile:
http://www.excelforum.com/member.php...o&userid=25694
View this thread: http://www.excelforum.com/showthread...hreadid=473066



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Question about VB constants

48 = 32 + 16 'directory + changed
22 = 16 + 4 + 2 'directory + system + hidden

The list of attributes that you see in Help IS the "full listing".

A file or directory can have move than one of the attributes: e.g. it can be
read-only, hidden, system, and directory with the archive bit set. All of that
information is returned on one value, which is a "bit map".

To determine whether your filespec is a directory, your would use something
like this

If (GetAttr(FileSpec) And vbDirectory) Then

which is directly analogous to the example in Help.

From HELP(I have added caps for emphasis):

"The value returned by GetAttr is the *SUM* of the following attribute values:

Constant Value Description
vbNormal 0 Normal.
vbReadOnly 1 Read-only.
vbHidden 2 Hidden.
vbSystem 4 System file.
vbDirectory 16 Directory or folder.
vbArchive 32 File has changed since last backup.
vbAlias 64 Specified file name is an alias. Available only on Mac

.....
To *DETERMINE WHICH ATTRIBUTES ARE SET, USE THE AND OPERATOR* to perform a
bitwise comparison of the value returned by the GetAttr function and the value
of the individual file attribute you want. If the result is not zero, that
attribute is set for the named file."

On Tue, 4 Oct 2005 12:37:29 -0500, turnerje
wrote:


I am using the GetAttr constant, with the reference being "P:\", and it
returns 48, when I would expect 16, because it is a directory. What
does the 48 reference to?
I know what the constants 0,1,2,4,8,16,32 mean. Is there a full listing
somewhere? I have also recieved the constant 22 for my "C:\"

Many Thanks in advance

Justin

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
Formula constants? Glenn L.[_2_] Excel Worksheet Functions 2 August 29th 08 01:47 PM
Manifest Constants in VBA Bill Martin Excel Discussion (Misc queries) 4 September 20th 05 04:27 AM
Newbie question.. what does [somedata] represent? Constants?? Alex Wolff[_2_] Excel Programming 1 March 11th 05 04:25 PM
constants Confused Excel Discussion (Misc queries) 3 December 2nd 04 05:05 PM
constants alekm Excel Programming 1 September 9th 04 12:16 PM


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