Sunday, September 19, 2010

Nice Tool - Analyze hard disk usage with Free WinDirStat Tool for Windows

WinDirStat is a disk usage statistics viewer and cleanup tool for Microsoft Windows.
On start up, it reads the whole directory tree once and then presents it in three useful views:
  • The directory list, which resembles the tree view of the Windows Explorer but is sorted by file/subtree size,
  • The treemap, which shows the whole contents of the directory tree straight away,
  • The extension list, which serves as a legend and shows statistics about the file types.

 It cab be downloaded from the following url
http://windirstat.info/

Tuesday, September 14, 2010

Excel - Concatenating dates with strings will result wrong value -WorkAround is use Text()

Open any excel -> Enter some date(let us say 12/07/2009) in the cell A1.
And add the following formula in B1
="Date ref: " &A$1   -> It gives the date value in a long format i.e Date ref:: 40154

Work Around

Use Text() function to format the date.

="Date ref: " &TEXT(A$1,"MM/dd/yyyy") -> It gives the date value as we expected ie. Date ref: 12/07/2009

How to activate and shut down the applications(IE, Notepad, Calculator etc etc) using VBA

Let us assume we want to activate Notepad/Calculator and shut it down.


Dim notepadID As Integer
' To activate a running Notepad process use the following command
AppActivate ("Untitled - Notepad")
' If you want to create a new instance and active that process please follow the following steps
 notepadID = Shell("NOTEPAD.EXE", 1)
' Activate the new instance of Notepad.
'AppActivate (notepadID)
SendKeys "Hello, RiskSpan team is in full Action", True
SendKeys "~", True
SendKeys "TechTalk", True


This piece of code opens a new Notepad instance and prints the text as

Hello, RiskSpan team is in full Action
TechTalk


And to invoke calculator and do some calculation

Sub Main()
Dim ReturnValue, I
ReturnValue = Shell("calc.exe", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
End Sub

'Ipconfig
Guys please keep one thing in mind, this will not work if you debug,  keep a break point at the end of the procedure/Function

Dim cmdId As Integer
cmdId = Shell("CMD.EXE", 1)
' Activate the new instance of Notepad.
AppActivate cmdId

SendKeys "ipconfig /all {ENTER}", True


Similar articles:


http://articles.techrepublic.com.com/5100-10878_11-1056137.html