Hide Folder Macro

  • Thread starter Thread starter Raj
  • Start date Start date
R

Raj

Hi all,

I would like to know if using a macro can we hide a folder,
if yes can i know how can i do it.......
 
Read the Help for SetAttr
However, depending on the user's Folder option settings, it may still be
visible.

NickHK
 
Raj said:
Hi all,

I would like to know if using a macro can we hide a folder,
if yes can i know how can i do it.......

Yes you can:

****************
Sub ChangeFolderAttribs()

Dim FSO As Scripting.FileSystemObject

Set FSO = New Scripting.FileSystemObject

FSO.GetFolder("C:\Temp\").Attributes = Hidden

Set FSO = Nothing

End Sub
****************

Make sure you have a reference to "Microsoft Scripting Runtime" (VBE -->
Tools --> References --> select "Microsoft Scripting Runtime" and close
with "OK".)

CoRrRan
 
Yes you can:

****************
Sub ChangeFolderAttribs()

Dim FSO As Scripting.FileSystemObject

Set FSO = New Scripting.FileSystemObject

FSO.GetFolder("C:\Temp\").Attributes = Hidden

Set FSO = Nothing

End Sub
****************

Make sure you have a reference to "Microsoft Scripting Runtime" (VBE -->
Tools --> References --> select "Microsoft Scripting Runtime" and close
with "OK".)

CoRrRan

Thx.......... how to unhide the folder...........
 
Raj said:
Thx.......... how to unhide the folder...........

Change:

FSO.GetFolder("C:\Temp\").Attributes = Hidden

To:

FSO.GetFolder("C:\Temp\").Attributes = Normal

CoRrRan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top