Total Pageviews

Friday, July 8, 2016

Expressions for Excel VBA Environ

Here's a list of few expressions for the Environ in Excel VBA

 Environ("os")
 Environ("tmp")
 Environ("path")
 Environ("path")
 Environ("windir")
 Environ("appdata")
 Environ("appdata")
 Environ("homepath")
 Environ("username")
 Environ("homedrive")
 Environ("userdomain")
 Environ("logonserver")
 Environ("sessionname")
 Environ("systemdrive")
 Environ("userprofile")
 Environ("computername")
 Environ("programfiles")
 Environ("allusersprofile")
 Environ("processor_level")
 Environ("commonprogramfiles")
 Environ("processor_revision")
 Environ("number_of_processors")
 Environ("processor_identifier")
 Environ("processor_architecture")

Will keep updating the list as and when i come across new once.

Thanks
Subhajit

Wednesday, July 6, 2016

Exploring The File System Object_Part 2

In my previous post I explored the few  methods of the fileSystemObject to find all the Sub Folders in a parent folder. Count of all files in them, their size and filetypes.
In this post I have used few more methods to build a macro which will do the following:
  1. Does whatever was possible in the last post ;) 
  2. Make different folders for different file types
  3. Copy all the files from the specified folder
  4. Organize the similar file types into their respective folders


This is how the excel file looks,







This is the main() subroutine which calls the organize routine,












This is the routine that organizes different file types into different folders






This is the initial and final output folders:























Please put your thoughts and comments below so that I can improve.

THANKS EVERYONE.
SUBHAJIT.
.
To Download the example file:
Please click this Google Drive Link

Friday, July 1, 2016

Exploring The File System Object_Part 1


We can use the Microsoft scripting runtime object library for working easily with files and folders.
Start with opening the references and checking the Microsoft scripting runtime library.
This gives a lot of objects collections, methods and properties in the scripting library.
You can browse through them by opening the object library.

Given below is a sample code for exploring few possibilities of the file system object. 
Put any folder link in the range(A2) and see the following information about the folder.
Sub Directories, Total Count of Files, File Types, Count of File Types , Size of Folder

Please find the file link below to see and explore the file.

========================================================================




========================================================================

Will write another blog on exploring properties of file methods.

Please put your thoughts and comments below so that I can improve.

THANKS EVERYONE.
SUBHAJIT.
.
To Download the example file:
Please click this Google Drive Link