ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Folder Macro (https://www.excelbanter.com/excel-programming/394078-re-hide-folder-macro.html)

Raj[_11_]

Hide Folder Macro
 
On Jul 24, 3:13 pm, CoRrRan wrote:
Raj wrote:
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


Thx.......... how to unhide the folder...........


CoRrRan

Hide Folder Macro
 
Raj wrote:
On Jul 24, 3:13 pm, CoRrRan wrote:
Raj wrote:
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


Thx.......... how to unhide the folder...........


Change:

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

To:

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

CoRrRan


All times are GMT +1. The time now is 11:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com