Hi All

I'm using the Scripting FileSystemObject. There's an Enum called
"FileAttribute" and has the following members:

Alias, Archive, Compressed, Directory, Hidden, Normal, ReadOnly, System,
Volume.

Being an Enum, you can do the usual stuff like:

Dim faAttributes As Scripting.FileAttribute
faAttributes = Archive Or Hidden Or ReadOnly

Now who knows how to refer to the system member of the FileAttribute Enum????

I know how to kludge around it but what's the correct syntax, since you can't
use:
faAttributes = System

Thanks in advance + Cheers - Peter

Re: Obscure VBA Syntax by Jezebel

Jezebel
Sat Feb 21 17:08:43 CST 2004

The short answer is: use '4'. (The ObjectBrowser lists the values.) It's
interesting that these enum values don't work like others in VB/VBA. Usually
you can bypass ambiguous naming by qualifying it with the class and enum
name (word.WdWindowState.wdWindowStateMaximize) ... but -- as I guess you
discovered -- it doesn't work in this case.

A lot of serious VB users have long decried the use of the Scripting object
entirely.




"Peter Hewett" <Nospam@xtra.co.nz> wrote in message
news:Xns949740159E8D4Iwlpth@207.46.248.16...
> Hi All
>
> I'm using the Scripting FileSystemObject. There's an Enum called
> "FileAttribute" and has the following members:
>
> Alias, Archive, Compressed, Directory, Hidden, Normal, ReadOnly, System,
> Volume.
>
> Being an Enum, you can do the usual stuff like:
>
> Dim faAttributes As Scripting.FileAttribute
> faAttributes = Archive Or Hidden Or ReadOnly
>
> Now who knows how to refer to the system member of the FileAttribute
Enum????
>
> I know how to kludge around it but what's the correct syntax, since you
can't
> use:
> faAttributes = System
>
> Thanks in advance + Cheers - Peter



Re: Obscure VBA Syntax by Peter

Peter
Sat Feb 21 17:55:18 CST 2004

Hi Jezebel

Yeah, you're right I tried name qualification and found that didn't work! I
understand about the ObjectBrowser <g> I was poking around last night and
the FileAttribute Enum and ObjectBrowser reckons the members belong to:
"Scripting.__MIDL___MIDL_itf_scrrun_0000_0001"!!!

I guess I'm not too serious. I quite like the FSO, it nicely bridges
Dir/GetAttr or Application.FileSearch and API functionality.

Thanks + Cheers - Peter


"Jezebel" <frolly@mkkk.com> wrote in
news:uqMLi9M#DHA.1456@TK2MSFTNGP09.phx.gbl:

> The short answer is: use '4'. (The ObjectBrowser lists the values.) It's
> interesting that these enum values don't work like others in VB/VBA.
> Usually you can bypass ambiguous naming by qualifying it with the class
> and enum name (word.WdWindowState.wdWindowStateMaximize) ... but -- as I
> guess you discovered -- it doesn't work in this case.
>
> A lot of serious VB users have long decried the use of the Scripting
> object entirely.
>
>
>
>
> "Peter Hewett" <Nospam@xtra.co.nz> wrote in message
> news:Xns949740159E8D4Iwlpth@207.46.248.16...
>> Hi All
>>
>> I'm using the Scripting FileSystemObject. There's an Enum called
>> "FileAttribute" and has the following members:
>>
>> Alias, Archive, Compressed, Directory, Hidden, Normal, ReadOnly,
>> System, Volume.
>>
>> Being an Enum, you can do the usual stuff like:
>>
>> Dim faAttributes As Scripting.FileAttribute
>> faAttributes = Archive Or Hidden Or ReadOnly
>>
>> Now who knows how to refer to the system member of the FileAttribute
> Enum????
>>
>> I know how to kludge around it but what's the correct syntax, since you
> can't
>> use:
>> faAttributes = System
>>
>> Thanks in advance + Cheers - Peter
>
>


Re: Obscure VBA Syntax by Jezebel

Jezebel
Sat Feb 21 19:07:52 CST 2004

I wondered about Scripting.__MIDL___MIDL_itf_scrrun_0000_0001 too. Google's
never heard of it.

And I agree about the FSO -- I've never had any problems with it either;
although there is a risk if you're distributing code that uses it: Norton
advises people to disable it, although I've never met anyone who does.




"Peter Hewett" <Nospam@xtra.co.nz> wrote in message
news:Xns949783717D64EIwlpth@207.46.248.16...
> Hi Jezebel
>
> Yeah, you're right I tried name qualification and found that didn't work!
I
> understand about the ObjectBrowser <g> I was poking around last night and
> the FileAttribute Enum and ObjectBrowser reckons the members belong to:
> "Scripting.__MIDL___MIDL_itf_scrrun_0000_0001"!!!
>
> I guess I'm not too serious. I quite like the FSO, it nicely bridges
> Dir/GetAttr or Application.FileSearch and API functionality.
>
> Thanks + Cheers - Peter
>
>
> "Jezebel" <frolly@mkkk.com> wrote in
> news:uqMLi9M#DHA.1456@TK2MSFTNGP09.phx.gbl:
>
> > The short answer is: use '4'. (The ObjectBrowser lists the values.) It's
> > interesting that these enum values don't work like others in VB/VBA.
> > Usually you can bypass ambiguous naming by qualifying it with the class
> > and enum name (word.WdWindowState.wdWindowStateMaximize) ... but -- as I
> > guess you discovered -- it doesn't work in this case.
> >
> > A lot of serious VB users have long decried the use of the Scripting
> > object entirely.
> >
> >
> >
> >
> > "Peter Hewett" <Nospam@xtra.co.nz> wrote in message
> > news:Xns949740159E8D4Iwlpth@207.46.248.16...
> >> Hi All
> >>
> >> I'm using the Scripting FileSystemObject. There's an Enum called
> >> "FileAttribute" and has the following members:
> >>
> >> Alias, Archive, Compressed, Directory, Hidden, Normal, ReadOnly,
> >> System, Volume.
> >>
> >> Being an Enum, you can do the usual stuff like:
> >>
> >> Dim faAttributes As Scripting.FileAttribute
> >> faAttributes = Archive Or Hidden Or ReadOnly
> >>
> >> Now who knows how to refer to the system member of the FileAttribute
> > Enum????
> >>
> >> I know how to kludge around it but what's the correct syntax, since you
> > can't
> >> use:
> >> faAttributes = System
> >>
> >> Thanks in advance + Cheers - Peter
> >
> >
>