Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Donate a UDF (UserDefineFunction)
#3
Hi ,

Below is the function to capture screen shot of desktop

Code:
'*******************************************************************************​********************************************************************************​
'Function        :  ScreenShot
'Author         :  ssvali
'Desc  :      It captures the screen shot of the desktop
'Parameter : ScrSht_Folder - Pass the path of the screenshot folder where u want save the screen shot
'*******************************************************************************​********************************************************************************​
Function ScreenShot(ScrSht_Folder)
        Dim sDateTimeNow, sFilePath
        sDateTimeNow = Replace(Replace(now,"/","_")," ","_")
        sFilePath = ScrSht_Folder &"\" &"ScreenShot_" &".png"
        Desktop.CaptureBitmap sFilePath, True
        ScreenShot = sFilePath
End Function
(06-08-2012, 06:28 PM)Ankesh Wrote: Thanks ssvali for taking the initative.

Here is the first UDF from me.

This will close any running application from taskbar.

Code:
'***************************************************************************************************************************************************************
'Function        :  CloseProcess
'Author         :  Ankesh
'Reviewer       :                                                                                                            
'Version No     :  
'Date Created   :  
'Last Updated   :  
'Desc  :      Forecefully kills a process displayed on the task manager. StrProgramName should contain the process name with extension
'***************************************************************************************************************************************************************
Public Function CloseProcess(strProgramName)
   Dim objShell
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run "TASKKILL /F /IM " & strProgramName
    Set objShell = Nothing
End Fun

'calling the function

Call CloseProcess("EXCEL.EXE") ''Closes excel

Call CloseProcess("Iexplore.EXE") ''Closes IE

'Similar way you can pass any application name running in taskmanager. Function will kill them all.

Regards,[/code]
Ankesh

Reply


Messages In This Thread
Donate a UDF (UserDefineFunction) - by ssvali - 06-08-2012, 05:29 PM
RE: Donate a UDF (UserDefineFunction) - by Ankesh - 06-08-2012, 06:28 PM
RE: Donate a UDF (UserDefineFunction) - by ssvali - 06-20-2012, 04:58 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)